protocol

package
v2.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBindReq

func DecodeBindReq(buf buffer.Buffer) (cid, uid int64, err error)

DecodeBindReq decodes a bind request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {cid + uid}

func DecodeBindRes

func DecodeBindRes(buf buffer.Buffer) (uint16, error)

DecodeBindRes decodes a bind response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeBroadcastReq

func DecodeBroadcastReq(req *buffer.Bytes) (session.Kind, bool, *buffer.Bytes, error)

DecodeBroadcastReq decodes a broadcast request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind + disconnect + <message packet>}

func DecodeBroadcastRes

func DecodeBroadcastRes(buf buffer.Buffer) (code uint16, total uint64, err error)

DecodeBroadcastRes decodes a broadcast response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code + [total]}

func DecodeDeliverReq

func DecodeDeliverReq(req *buffer.Bytes) (int64, int64, *buffer.Bytes, error)

DecodeDeliverReq decodes a deliver request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {cid + uid + <message packet>}

func DecodeDeliverRes

func DecodeDeliverRes(buf buffer.Buffer) (uint16, error)

DecodeDeliverRes decodes a deliver response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeDisconnectReq

func DecodeDisconnectReq(buf buffer.Buffer) (kind session.Kind, target int64, force bool, err error)

DecodeDisconnectReq decodes a disconnect request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind + target + force}

func DecodeDisconnectRes

func DecodeDisconnectRes(buf buffer.Buffer) (uint16, error)

DecodeDisconnectRes decodes a disconnect response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeGetIPReq

func DecodeGetIPReq(buf buffer.Buffer) (kind session.Kind, target int64, err error)

DecodeGetIPReq decodes a get-IP request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind + target}

func DecodeGetIPRes

func DecodeGetIPRes(buf buffer.Buffer) (code uint16, ip string, err error)

DecodeGetIPRes decodes a get-IP response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code + [ip]}

func DecodeGetStateReq

func DecodeGetStateReq(buf buffer.Buffer) error

DecodeGetStateReq decodes a get-state request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq}

func DecodeGetStateRes

func DecodeGetStateRes(buf buffer.Buffer) (code uint16, state cluster.State, err error)

DecodeGetStateRes decodes a get-state response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code + cluster state}

func DecodeHandshakeReq

func DecodeHandshakeReq(buf buffer.Buffer) (cluster.Kind, string, uint64, error)

DecodeHandshakeReq decodes a handshake request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {ins kind + ins id + conn epoch}

func DecodeHandshakeRes

func DecodeHandshakeRes(buf buffer.Buffer) (uint16, error)

DecodeHandshakeRes decodes a handshake response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeIsOnlineReq

func DecodeIsOnlineReq(buf buffer.Buffer) (kind session.Kind, target int64, err error)

DecodeIsOnlineReq decodes an is-online request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind + target}

func DecodeIsOnlineRes

func DecodeIsOnlineRes(buf buffer.Buffer) (code uint16, isOnline bool, err error)

DecodeIsOnlineRes decodes an is-online response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code + online state}

func DecodeMulticastReq

func DecodeMulticastReq(req *buffer.Bytes) (session.Kind, []int64, bool, *buffer.Bytes, error)

DecodeMulticastReq decodes a multicast request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind + count + targets + disconnect + <message packet>}

func DecodeMulticastRes

func DecodeMulticastRes(buf buffer.Buffer) (code uint16, total uint64, err error)

DecodeMulticastRes decodes a multicast response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code + [total]}

func DecodePublishReq added in v2.3.0

func DecodePublishReq(req *buffer.Bytes) (string, bool, *buffer.Bytes, error)

DecodePublishReq decodes a publish request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {channel len + channel + disconnect + <message packet>}

func DecodePublishRes added in v2.3.0

func DecodePublishRes(buf buffer.Buffer) (code uint16, total uint64, err error)

DecodePublishRes decodes a publish response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code + [total]}

func DecodePushReq

func DecodePushReq(req *buffer.Bytes) (session.Kind, int64, bool, *buffer.Bytes, error)

DecodePushReq decodes a push request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind + target + disconnect + <message packet>}

func DecodePushRes

func DecodePushRes(buf buffer.Buffer) (uint16, error)

DecodePushRes decodes a push response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeSetStateReq

func DecodeSetStateReq(buf buffer.Buffer) (state cluster.State, err error)

DecodeSetStateReq decodes a set-state request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {cluster state}

func DecodeSetStateRes

func DecodeSetStateRes(buf buffer.Buffer) (uint16, error)

DecodeSetStateRes decodes a set-state response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeStatReq

func DecodeStatReq(buf buffer.Buffer) (kind session.Kind, err error)

DecodeStatReq decodes a stat request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind}

func DecodeStatRes

func DecodeStatRes(buf buffer.Buffer) (code uint16, total uint64, err error)

DecodeStatRes decodes a stat response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code + [total]}

func DecodeSubscribeReq added in v2.3.0

func DecodeSubscribeReq(buf buffer.Buffer) (kind session.Kind, targets []int64, channel string, err error)

DecodeSubscribeReq decodes a subscribe request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind + count + targets + channel}

func DecodeSubscribeRes added in v2.3.0

func DecodeSubscribeRes(buf buffer.Buffer) (uint16, error)

DecodeSubscribeRes decodes a subscribe response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeTriggerReq

func DecodeTriggerReq(buf *buffer.Bytes) (event cluster.Event, cid int64, uid int64, err error)

DecodeTriggerReq decodes a trigger request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {event + cid + [uid]}

func DecodeTriggerRes

func DecodeTriggerRes(buf buffer.Buffer) (uint16, error)

DecodeTriggerRes decodes a trigger response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeUnbindReq

func DecodeUnbindReq(buf buffer.Buffer) (uid int64, err error)

DecodeUnbindReq decodes an unbind request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {uid}

func DecodeUnbindRes

func DecodeUnbindRes(buf buffer.Buffer) (uint16, error)

DecodeUnbindRes decodes an unbind response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func DecodeUnsubscribeReq added in v2.3.0

func DecodeUnsubscribeReq(buf buffer.Buffer) (kind session.Kind, targets []int64, channel string, err error)

DecodeUnsubscribeReq decodes an unsubscribe request. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {session kind + count + targets + channel}

func DecodeUnsubscribeRes added in v2.3.0

func DecodeUnsubscribeRes(buf buffer.Buffer) (uint16, error)

DecodeUnsubscribeRes decodes an unsubscribe response. Note that buf contains only the private section. Protocol: public section: {size + header + route + seq} + private section: {code}

func EncodeBindReq

func EncodeBindReq(seq uint64, cid, uid int64) *buffer.NocopyBuffer

EncodeBindReq encodes a bind request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {cid + uid}

func EncodeBindRes

func EncodeBindRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodeBindRes encodes a bind response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code}

func EncodeBroadcastReq

func EncodeBroadcastReq(seq uint64, kind session.Kind, disconnect bool, message buffer.Buffer) *buffer.NocopyBuffer

EncodeBroadcastReq encodes a broadcast request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {session kind + disconnect + <message packet>}

func EncodeBroadcastRes

func EncodeBroadcastRes(seq uint64, code uint16, total ...uint64) *buffer.NocopyBuffer

EncodeBroadcastRes encodes a broadcast response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code + [total]}

func EncodeDeliverReq

func EncodeDeliverReq(seq uint64, cid int64, uid int64, buf buffer.Buffer) *buffer.NocopyBuffer

EncodeDeliverReq encodes a deliver request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {cid + uid + <message packet>}

func EncodeDeliverRes

func EncodeDeliverRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodeDeliverRes encodes a deliver response. Protocol: size + header + route + seq + code

func EncodeDisconnectReq

func EncodeDisconnectReq(seq uint64, kind session.Kind, target int64, force bool) *buffer.NocopyBuffer

EncodeDisconnectReq encodes a disconnect request. Note that buf contains the full protocol. Protocol: {size + header + route + seq} + private section: {session kind + target + force}

func EncodeDisconnectRes

func EncodeDisconnectRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodeDisconnectRes encodes a disconnect response. Note that buf contains the full protocol. Protocol: {size + header + route + seq} + private section: {code}

func EncodeGetIPReq

func EncodeGetIPReq(seq uint64, kind session.Kind, target int64) *buffer.NocopyBuffer

EncodeGetIPReq encodes a get-IP request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {session kind + target}

func EncodeGetIPRes

func EncodeGetIPRes(seq uint64, code uint16, ip ...string) *buffer.NocopyBuffer

EncodeGetIPRes encodes a get-IP response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code + [ip]}

func EncodeGetStateReq

func EncodeGetStateReq(seq uint64) *buffer.NocopyBuffer

EncodeGetStateReq encodes a get-state request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq}

func EncodeGetStateRes

func EncodeGetStateRes(seq uint64, code uint16, state cluster.State) *buffer.NocopyBuffer

EncodeGetStateRes encodes a get-state response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code + cluster state}

func EncodeHandshakeReq

func EncodeHandshakeReq(seq uint64, kind cluster.Kind, inst string, epoch uint64) buffer.Buffer

EncodeHandshakeReq encodes a handshake request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {ins kind + ins id + conn epoch}

func EncodeHandshakeRes

func EncodeHandshakeRes(seq uint64, code uint16) buffer.Buffer

EncodeHandshakeRes encodes a handshake response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code}

func EncodeIsOnlineReq

func EncodeIsOnlineReq(seq uint64, kind session.Kind, target int64) *buffer.NocopyBuffer

EncodeIsOnlineReq encodes an is-online request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {session kind + target}

func EncodeIsOnlineRes

func EncodeIsOnlineRes(seq uint64, code uint16, isOnline bool) *buffer.NocopyBuffer

EncodeIsOnlineRes encodes an is-online response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code + online state}

func EncodeMulticastReq

func EncodeMulticastReq(seq uint64, kind session.Kind, targets []int64, disconnect bool, message buffer.Buffer) *buffer.NocopyBuffer

EncodeMulticastReq encodes a multicast request (at most 65535 targets). Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {session kind + count + targets + disconnect + <message packet>}

func EncodeMulticastRes

func EncodeMulticastRes(seq uint64, code uint16, total ...uint64) *buffer.NocopyBuffer

EncodeMulticastRes encodes a multicast response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code + [total]}

func EncodePublishReq added in v2.3.0

func EncodePublishReq(seq uint64, channel string, disconnect bool, message buffer.Buffer) *buffer.NocopyBuffer

EncodePublishReq encodes a publish request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {channel len + channel + disconnect + <message packet>}

func EncodePublishRes added in v2.3.0

func EncodePublishRes(seq uint64, code uint16, total ...uint64) *buffer.NocopyBuffer

EncodePublishRes encodes a publish response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code + [total]}

func EncodePushReq

func EncodePushReq(seq uint64, kind session.Kind, target int64, disconnect bool, message buffer.Buffer) *buffer.NocopyBuffer

EncodePushReq encodes a push request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {session kind + target + disconnect + <message packet>}

func EncodePushRes

func EncodePushRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodePushRes encodes a push response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code}

func EncodeSetStateReq

func EncodeSetStateReq(seq uint64, state cluster.State) *buffer.NocopyBuffer

EncodeSetStateReq encodes a set-state request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {cluster state}

func EncodeSetStateRes

func EncodeSetStateRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodeSetStateRes encodes a set-state response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code}

func EncodeStatReq

func EncodeStatReq(seq uint64, kind session.Kind) *buffer.NocopyBuffer

EncodeStatReq encodes a stat request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {session kind}

func EncodeStatRes

func EncodeStatRes(seq uint64, code uint16, total ...uint64) *buffer.NocopyBuffer

EncodeStatRes encodes a stat response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code + [total]}

func EncodeSubscribeReq added in v2.3.0

func EncodeSubscribeReq(seq uint64, kind session.Kind, targets []int64, channel string) *buffer.NocopyBuffer

EncodeSubscribeReq encodes a subscribe request (at most 65535 targets per call). Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {session kind + count + targets + channel}

func EncodeSubscribeRes added in v2.3.0

func EncodeSubscribeRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodeSubscribeRes encodes a subscribe response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code}

func EncodeTriggerReq

func EncodeTriggerReq(seq uint64, event cluster.Event, cid int64, uid ...int64) *buffer.NocopyBuffer

EncodeTriggerReq encodes a trigger request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {event + cid + [uid]}

func EncodeTriggerRes

func EncodeTriggerRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodeTriggerRes encodes a trigger response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code}

func EncodeUnbindReq

func EncodeUnbindReq(seq uint64, uid int64) *buffer.NocopyBuffer

EncodeUnbindReq encodes an unbind request. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {uid}

func EncodeUnbindRes

func EncodeUnbindRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodeUnbindRes encodes an unbind response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code}

func EncodeUnsubscribeReq added in v2.3.0

func EncodeUnsubscribeReq(seq uint64, kind session.Kind, targets []int64, channel string) *buffer.NocopyBuffer

EncodeUnsubscribeReq encodes an unsubscribe request (at most 65535 targets per call). Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {session kind + count + targets + channel}

func EncodeUnsubscribeRes added in v2.3.0

func EncodeUnsubscribeRes(seq uint64, code uint16) *buffer.NocopyBuffer

EncodeUnsubscribeRes encodes an unsubscribe response. Note that buf contains the full protocol. Protocol: public section: {size + header + route + seq} + private section: {code}

func Heartbeat

func Heartbeat() []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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