Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidPacket = errors.New("ws: invalid packet")
View Source
var ErrUnknowHandler = errors.New("ws: unknown handler")
Functions ¶
Types ¶
type Connection ¶
type Connection struct { Request *http.Request Values sync.Map // contains filtered or unexported fields }
Connection holds all data and websocket connection
func (*Connection) Context ¶
func (conn *Connection) Context() context.Context
type Hook ¶
type Hook func(conn *Connection)
Hook is function called before main loop or after connection was closed
type Request ¶
type Request struct { C *Connection `json:"-"` ID int64 Topic string Data json.RawMessage }
Request represents data sends from client to server
type WS ¶
type WS struct { ErrorHandler func(c *Connection, err error) Upgrader websocket.Upgrader // contains filtered or unexported fields }
func (*WS) RegisterHandler ¶
RegisterHandler register function for entered topic note that handlerFn is interface{} but should be function (func(r *Request, optionalParameter string))
Click to show internal directories.
Click to hide internal directories.