channels

package
v0.3.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const (
	NewWASMEventModelTag   worker.Tag = "NewWASMEventModel"
	EventUpdateCallbackTag worker.Tag = "EventUpdateCallback"

	JoinChannelTag         worker.Tag = "JoinChannel"
	LeaveChannelTag        worker.Tag = "LeaveChannel"
	ReceiveMessageTag      worker.Tag = "ReceiveMessage"
	ReceiveReplyTag        worker.Tag = "ReceiveReply"
	ReceiveReactionTag     worker.Tag = "ReceiveReaction"
	UpdateFromUUIDTag      worker.Tag = "UpdateFromUUID"
	UpdateFromMessageIDTag worker.Tag = "UpdateFromMessageID"
	GetMessageTag          worker.Tag = "GetMessage"
	DeleteMessageTag       worker.Tag = "DeleteMessage"
	MuteUserTag            worker.Tag = "MuteUser"
)

List of tags that can be used when sending a message or registering a handler to receive a message.

Variables

This section is empty.

Functions

func NewWASMEventModel

func NewWASMEventModel(path, wasmJsPath string, encryption idbCrypto.Cipher,
	cbs bindings.ChannelUICallbacks) (channels.EventModel, error)

NewWASMEventModel returns a channels.EventModel backed by a wasmModel. The name should be a base64 encoding of the users public key.

func NewWASMEventModelBuilder

func NewWASMEventModelBuilder(wasmJsPath string, encryption idbCrypto.Cipher,
	channelCbs bindings.ChannelUICallbacks) channels.EventModelBuilder

NewWASMEventModelBuilder returns an EventModelBuilder which allows the channel manager to define the path but the callback is the same across the board.

Types

type EncryptionStatusMessage

type EncryptionStatusMessage struct {
	DatabaseName     string `json:"databaseName"`
	EncryptionStatus bool   `json:"encryptionStatus"`
}

EncryptionStatusMessage is JSON marshalled and received from the worker when the database checks if it is encrypted.

type EncryptionStatusReply

type EncryptionStatusReply struct {
	EncryptionStatus bool   `json:"encryptionStatus"`
	Error            string `json:"error"`
}

EncryptionStatusReply is JSON marshalled and sent to the worker is response to the EncryptionStatusMessage.

type EventUpdateCallbackMessage added in v0.3.4

type EventUpdateCallbackMessage struct {
	EventType int64  `json:"eventType"`
	JsonData  []byte `json:"jsonData"`
}

EventUpdateCallbackMessage is JSON marshalled and received from the worker for the EventUpdate callback.

type GetMessageMessage

type GetMessageMessage struct {
	Message channels.ModelMessage `json:"message"`
	Error   string                `json:"error"`
}

GetMessageMessage is JSON marshalled and sent to the worker for [wasmModel.GetMessage].

type MessageUpdateInfo

type MessageUpdateInfo struct {
	UUID uint64 `json:"uuid"`

	MessageID    message.ID `json:"messageID"`
	MessageIDSet bool       `json:"messageIDSet"`

	Timestamp    time.Time `json:"timestamp"`
	TimestampSet bool      `json:"timestampSet"`

	RoundID    id.Round `json:"round"`
	RoundIDSet bool     `json:"roundIDSet"`

	Pinned    bool `json:"pinned"`
	PinnedSet bool `json:"pinnedSet"`

	Hidden    bool `json:"hidden"`
	HiddenSet bool `json:"hiddenSet"`

	Status    channels.SentStatus `json:"status"`
	StatusSet bool                `json:"statusSet"`
}

MessageUpdateInfo is JSON marshalled and sent to the worker for [wasmModel.UpdateFromMessageID] and [wasmModel.UpdateFromUUID].

type MuteUserMessage

type MuteUserMessage struct {
	ChannelID *id.ID            `json:"channelID"`
	PubKey    ed25519.PublicKey `json:"pubKey"`
	Unmute    bool              `json:"unmute"`
}

MuteUserMessage is JSON marshalled and sent to the worker for [wasmModel.MuteUser].

type NewWASMEventModelMessage

type NewWASMEventModelMessage struct {
	DatabaseName   string `json:"databaseName"`
	EncryptionJSON string `json:"encryptionJSON"`
}

NewWASMEventModelMessage is JSON marshalled and sent to the worker for NewWASMEventModel.

type ReceiveReplyMessage

type ReceiveReplyMessage struct {
	ReactionTo            message.ID `json:"replyTo"`
	channels.ModelMessage `json:"message"`
}

ReceiveReplyMessage is JSON marshalled and sent to the worker for [wasmModel.ReceiveReply].

type UuidError added in v0.3.3

type UuidError struct {
	UUID  uint64 `json:"uuid"`
	Error string `json:"error"`
}

UuidError is JSON marshalled and sent to the worker for [wasmModel.UpdateFromMessageID].

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL