Documentation ¶
Index ¶
- Constants
- func NewWASMEventModel(path, wasmJsPath string, encryption cryptoChannel.Cipher, ...) (channels.EventModel, error)
- func NewWASMEventModelBuilder(wasmJsPath string, encryption cryptoChannel.Cipher, ...) channels.EventModelBuilder
- type DeletedMessageCallback
- type EncryptionStatusMessage
- type EncryptionStatusReply
- type GetMessageMessage
- type MessageReceivedCallback
- type MessageReceivedCallbackMessage
- type MessageUpdateInfo
- type MuteUserMessage
- type MutedUserCallback
- type NewWASMEventModelMessage
- type ReceiveReplyMessage
Constants ¶
const ( NewWASMEventModelTag worker.Tag = "NewWASMEventModel" MessageReceivedCallbackTag worker.Tag = "MessageReceivedCallback" DeletedMessageCallbackTag worker.Tag = "DeletedMessageCallback" MutedUserCallbackTag worker.Tag = "MutedUserCallback" EncryptionStatusTag worker.Tag = "EncryptionStatus" StoreDatabaseNameTag worker.Tag = "StoreDatabaseName" 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 cryptoChannel.Cipher, messageReceivedCB MessageReceivedCallback, deletedMessageCB DeletedMessageCallback, mutedUserCB MutedUserCallback) ( 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 cryptoChannel.Cipher, messageReceivedCB MessageReceivedCallback, deletedMessageCB DeletedMessageCallback, mutedUserCB MutedUserCallback) 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 DeletedMessageCallback ¶
DeletedMessageCallback is called any time a message is deleted.
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 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 MessageReceivedCallback ¶
MessageReceivedCallback is called any time a message is received or updated.
update is true if the row is old and was edited.
type MessageReceivedCallbackMessage ¶
type MessageReceivedCallbackMessage struct { UUID uint64 `json:"uuid"` ChannelID *id.ID `json:"channelID"` Update bool `json:"update"` }
MessageReceivedCallbackMessage is JSON marshalled and received from the worker for the MessageReceivedCallback callback.
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 MutedUserCallback ¶
MutedUserCallback is called any time a user is muted or unmuted. unmute is true if the user has been unmuted and false if they have been muted.
type NewWASMEventModelMessage ¶
type NewWASMEventModelMessage struct { Path string `json:"path"` 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].