Documentation ¶
Index ¶
- Constants
- func AckError(msg string) string
- func AckResp(msg string) string
- func SetAdapter(adaptor SignalingAdaptor) error
- func SetHandlers(auth AuthHandler, conn ConnectHandler, disc DisconnectHandler)
- type AuthHandler
- type ConnectHandler
- type DisconnectHandler
- type EventAck
- type SignalingAdaptor
- type SignalingEvent
Constants ¶
View Source
const ( // StSuccess success status StSuccess = iota + 1 // StError error status StError )
Variables ¶
This section is empty.
Functions ¶
func SetAdapter ¶
func SetAdapter(adaptor SignalingAdaptor) error
Set adapter to register socket signaling events.
func SetHandlers ¶
func SetHandlers(auth AuthHandler, conn ConnectHandler, disc DisconnectHandler)
Set handler to execute clients authenticate, connect and disconnect.
Types ¶
type AuthHandler ¶
Auth client outset, it will disconnect when return no-nil error
@param token client login jwt-token contain uuid or optional data in claims key string @return - string client uuid - any client optional data parsed from token - error Exception message
type ConnectHandler ¶
Client connected callback, it will disconnect when return no-nil error
@param uuid client unique id @param option client login optional data, maybe nil @return - error Exception message
type DisconnectHandler ¶
type DisconnectHandler func(uuid, option string)
Client disconnected handler function
@param uuid client unique id @param option client login optional data, maybe nil
`NOTICE` :
The client of uuid already released when call this event function.
type SignalingAdaptor ¶
type SignalingAdaptor interface { // Retruen socket signaling events Signalings() []string // Dispath socket signaling callback by event Dispatch(evt string) SignalingEvent }
Socket signaling adaptor to register events
Click to show internal directories.
Click to hide internal directories.