Documentation
¶
Index ¶
- type ChatMessage
- type Mesh
- func (m *Mesh) PublishChat(ctx context.Context, msg ChatMessage) error
- func (m *Mesh) PublishParty(ctx context.Context, msg PartyMessage) error
- func (m *Mesh) PublishPresence(ctx context.Context, msg PresenceEventMessage) error
- func (m *Mesh) PublishStreamBroadcast(ctx context.Context, msg StreamSendMessage) error
- func (m *Mesh) PublishStreamSend(ctx context.Context, targetNode string, msg StreamSendMessage) error
- func (m *Mesh) SetChatHandler(fn func(ChatMessage))
- func (m *Mesh) SetPartyHandler(fn func(PartyMessage))
- func (m *Mesh) SetPresenceHandler(fn func(PresenceEventMessage))
- func (m *Mesh) SetStreamHandler(fn func(StreamSendMessage))
- func (m *Mesh) Start(ctx context.Context)
- func (m *Mesh) Stop()
- type PartyMessage
- type PresenceEventMessage
- type StreamSendMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatMessage ¶
type ChatMessage struct {
SourceNode string `json:"source_node"`
ChannelID string `json:"channel_id"`
Payload json.RawMessage `json:"payload"`
}
ChatMessage carries channel chat payloads across nodes.
type Mesh ¶
type Mesh struct {
// contains filtered or unexported fields
}
Mesh routes realtime social payloads across nodes via Redis Pub/Sub.
func (*Mesh) PublishChat ¶
func (m *Mesh) PublishChat(ctx context.Context, msg ChatMessage) error
PublishChat broadcasts chat to all nodes.
func (*Mesh) PublishParty ¶
func (m *Mesh) PublishParty(ctx context.Context, msg PartyMessage) error
PublishParty broadcasts a party event to all peer nodes.
func (*Mesh) PublishPresence ¶
func (m *Mesh) PublishPresence(ctx context.Context, msg PresenceEventMessage) error
PublishPresence broadcasts a presence event to all peer nodes.
func (*Mesh) PublishStreamBroadcast ¶
func (m *Mesh) PublishStreamBroadcast(ctx context.Context, msg StreamSendMessage) error
PublishStreamBroadcast publishes stream payloads to all peer nodes.
func (*Mesh) PublishStreamSend ¶
func (m *Mesh) PublishStreamSend(ctx context.Context, targetNode string, msg StreamSendMessage) error
PublishStreamSend publishes a stream payload to a target node.
func (*Mesh) SetChatHandler ¶
func (m *Mesh) SetChatHandler(fn func(ChatMessage))
func (*Mesh) SetPartyHandler ¶
func (m *Mesh) SetPartyHandler(fn func(PartyMessage))
func (*Mesh) SetPresenceHandler ¶
func (m *Mesh) SetPresenceHandler(fn func(PresenceEventMessage))
func (*Mesh) SetStreamHandler ¶
func (m *Mesh) SetStreamHandler(fn func(StreamSendMessage))
type PartyMessage ¶
type PartyMessage struct {
SourceNode string `json:"source_node"`
PartyID string `json:"party_id"`
Payload json.RawMessage `json:"payload"`
}
PartyMessage carries party events across nodes.
type PresenceEventMessage ¶
type PresenceEventMessage struct {
SourceNode string `json:"source_node"`
Kind string `json:"kind"` // join|leave|update
Payload json.RawMessage `json:"payload"`
}
PresenceEventMessage carries cross-node status join/leave/update payloads.
type StreamSendMessage ¶
type StreamSendMessage struct {
SourceNode string `json:"source_node"`
Mode int16 `json:"mode"`
Subject string `json:"subject"`
Subcontext string `json:"subcontext"`
Label string `json:"label"`
Data string `json:"data"`
SessionIDs []string `json:"session_ids,omitempty"`
}
StreamSendMessage fans out stream payloads to peer nodes.
Click to show internal directories.
Click to hide internal directories.