func ExposeCommands()
func SetCustomDisconnectCmdOnUserDiscard(ver uint8, cmd uint16)
SetCustomDisconnectCmdOnUserDiscard sets ver and cmd for call disconnect when user is discarded autmatically.
func SetOnUserDiscardDisconnectBytes(fn func(*user.User) []byte)
SetOnUserDiscardDisconnectBytes defines a custom function to create call disconnect message bytes on user discard.
func Setup()
Setup must be called in the server main function to setup dm module before diarkis.Start
Call direct message channel for 2 users
type Call struct { OnReceive func(myUID string, peerUID string, message []byte) OnDisconnect func(myUID string, peerUID string) // contains filtered or unexported fields }
func GetCallByPeerID(uid string) *Call
GetCallByPeerID returns a call channel by the peer user ID
func NewCall(myUID string, uid string, callback func(error)) *Call
NewCall creates a new call channel with a given user to send and receive direct messages
func (c *Call) Connect(uid string, done func(error))
Connect starts a new call channel
func (c *Call) Disconnect(ver uint8, cmd uint16, message []byte)
Disconnect disconnects direct message call channel and sends a message to the peer
func (c *Call) RSend(ver uint8, cmd uint16, message []byte)
Send sends a reliable (UDP only) direct message to the peer
func (c *Call) Send(ver uint8, cmd uint16, message []byte)
Send sends an unreliable (UDP only) direct message to the peer