Documentation ¶
Overview ¶
Package psig describes the communication protocol.
Index ¶
Constants ¶
View Source
const ( // SigControl describes Control Signal SigControl = "control" // SigData describes Data Signal SigData = "data" )
View Source
const ( // OpChannelJoin describes peer join a channel. If it is client->server, means the peer is requesting to join the channel; if it's server->client, means the peer has joined the channel. OpChannelJoin = "channel_join" // OpPeerOffline describes peer leave a channel. OpPeerOffline = "peer_offline" // OpPeerOnline only used in server->client, notify others in the channel that the peer has joined the channel. OpPeerOnline = "peer_online" // OpState only used in client->client, notify others in the channel that the peer's state has been updated. OpState = "peer_state" )
View Source
const PrscdDataTag uint32 = 0x21
PrscdDataTag is the tag of prscd data.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelEvent ¶
ChannelEvent is Presencejs Channel event data structure used in channel.broadcast() and channel.subscribe()
type PrscdContext ¶
type PrscdContext interface { // ReadEvent loads event from ctx. ReadEvent() (*ChannelEvent, error) // WriteEvent writes event to ctx. WriteEvent(event *ChannelEvent) error // ReadSignalling returns the Signalling. ReadSignalling() *Signalling }
PrscdContext is the context for prscd, you can load events from ctx and write events to it.
func NewContext ¶
func NewContext(ctx serverless.Context, sfnName string) (PrscdContext, error)
NewContext returns context for prscd from serverless.Context. The Context can be used to load events and write events.
type Signalling ¶
type Signalling struct { Type string `msgpack:"t"` // Type describes the type of signalling, `Data Signal` or `Control Signal` OpCode string `msgpack:"op,omitempty"` // OpCode describes the operation type of signalling Channel string `msgpack:"c"` // Channel describes the channel Sid string `msgpack:"sid,omitempty"` // Sid describes the peer id on this node in backend Payload []byte `msgpack:"pl,omitempty"` // Payload describes the payload data of signalling Cid string `msgpack:"p"` // Cid describes the client id of peer, set by developer AppID string `msgpack:"app,omitempty"` // AppID describes the app_id MeshID string `msgpack:"mesh,omitempty"` // MeshID describes the mesh_id of this node }
Signalling describes the message format on this geo-distributed network.
func (*Signalling) String ¶
func (sig *Signalling) String() string
String returns the string representation of signalling.
Click to show internal directories.
Click to hide internal directories.