Versions in this module Expand all Collapse all v0 v0.1.0 Feb 6, 2020 Changes in this version + const All + const Broadcast + const CloseMessage + const DefaultEvtMessageKey + const DefaultWebsocketMaxMessageSize + const DefaultWebsocketPingPeriod + const DefaultWebsocketPongTimeout + const DefaultWebsocketReadBufferSize + const DefaultWebsocketReadTimeout + const DefaultWebsocketWriteTimeout + const DefaultWebsocketWriterBufferSize + const WriteWait + var DefaultIDGenerator = func(r *http.Request) string + var ErrAlreadyDisconnected = errors.New("already disconnected") + type Config struct + BinaryMessages bool + CheckOrigin func(r *http.Request) bool + EnableCompression bool + Error func(w http.ResponseWriter, r *http.Request, status int, reason error) + EvtMessagePrefix []byte + HandshakeTimeout time.Duration + IDGenerator func(r *http.Request) string + MaxMessageSize int64 + PingPeriod time.Duration + PongTimeout time.Duration + ReadBufferSize int + ReadTimeout time.Duration + Subprotocols []string + WriteBufferSize int + WriteTimeout time.Duration + func (c Config) Validate() Config + type Connection interface + Disconnect func() error + Err func() error + FireOnError func(err error) + GetValue func(key string) interface{} + GetValueArrString func(key string) []string + GetValueInt func(key string) int + GetValueString func(key string) string + ID func() string + IsJoined func(roomName string) bool + Join func(string) + Leave func(string) bool + On func(string, MessageFunc) + OnDisconnect func(DisconnectFunc) + OnError func(ErrorFunc) + OnLeave func(roomLeaveCb LeaveRoomFunc) + OnMessage func(NativeMessageFunc) + OnPing func(PingFunc) + OnPong func(PongFunc) + Server func() *Server + SetValue func(key string, value interface{}) + To func(string) Emitter + Wait func() + Write func(websocketMessageType int, data []byte) error + type ConnectionFunc func(Connection) + type ConnectionValues []connectionValue + func (r *ConnectionValues) Get(key string) interface{} + func (r *ConnectionValues) Reset() + func (r *ConnectionValues) Set(key string, value interface{}) + type DisconnectFunc func() + type Emitter interface + Emit func(string, interface{}) error + EmitMessage func([]byte) error + type ErrorFunc (func(error)) + type LeaveRoomFunc func(roomName string) + type MessageFunc interface + type NativeMessageFunc func([]byte) + type PingFunc func() + type PongFunc func() + type Server struct + func New(cfg Config) *Server + func (s *Server) Broadcast(to string, evt string, data interface{}) error + func (s *Server) Disconnect(connID string) (err error) + func (s *Server) GetConnection(connID string) Connection + func (s *Server) GetConnections() []Connection + func (s *Server) GetConnectionsByRoom(roomName string) []Connection + func (s *Server) GetTotalConnections() (n int) + func (s *Server) IsConnected(connID string) bool + func (s *Server) IsJoined(roomName string, connID string) bool + func (s *Server) Join(roomName string, connID string) + func (s *Server) Leave(roomName string, connID string) bool + func (s *Server) LeaveAll(connID string) + func (s *Server) OnConnection(cb ConnectionFunc) + func (s *Server) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*connection, error) + type UnderlineConnection interface + Close func() error + NextWriter func(messageType int) (io.WriteCloser, error) + ReadMessage func() (messageType int, p []byte, err error) + SetPingHandler func(h func(appData string) error) + SetPongHandler func(h func(appData string) error) + SetReadDeadline func(t time.Time) error + SetReadLimit func(limit int64) + SetWriteDeadline func(t time.Time) error + WriteControl func(messageType int, data []byte, deadline time.Time) error + WriteMessage func(messageType int, data []byte) error