Documentation
¶
Index ¶
- Constants
- Variables
- func AddrPolling(host string, port int, path string, secure bool) string
- func AddrWebsocket(host string, port int, secure bool) string
- func CountOverfloodingChannels() int
- type Channel
- func (c *Channel) Ack(name string, payload interface{}, timeout time.Duration) (string, error)
- func (c *Channel) Amount(room string) int
- func (c *Channel) BroadcastTo(room, name string, payload interface{})
- func (c *Channel) Close() error
- func (c *Channel) Emit(name string, payload interface{}) error
- func (c *Channel) IP() string
- func (c *Channel) Id() string
- func (c *Channel) IsAlive() bool
- func (c *Channel) Join(room string) error
- func (c *Channel) Leave(room string) error
- func (c *Channel) List(room string) []*Channel
- func (c *Channel) RequestHeader() http.Header
- type Client
- type Server
- func (s *Server) Amount(room string) int
- func (s *Server) BroadcastTo(room, name string, payload interface{})
- func (s *Server) BroadcastToAll(method string, payload interface{})
- func (s *Server) CountChannels() int
- func (s *Server) CountRooms() int
- func (s *Server) GetChannel(sid string) (*Channel, error)
- func (s *Server) List(room string) []*Channel
- func (e Server) On(name string, f interface{}) error
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
Constants ¶
const ( OnConnection = "connection" OnDisconnection = "disconnection" OnError = "error" )
Variables ¶
var ( ErrorSendTimeout = errors.New("timeout") ErrorSocketOverflood = errors.New("socket overflood") )
var ( ErrorHandlerIsNotFunc = errors.New("f is not a function") ErrorHandlerHasNot2Args = errors.New("f should have 1 or 2 arguments") ErrorHandlerWrongResult = errors.New("f should return no more than one value") )
var ( ErrorServerNotSet = errors.New("server was not set") ErrorConnectionNotFound = errors.New("connection not found") )
var (
ErrorAckWaiterNotFound = errors.New("ack waiter not found")
)
Functions ¶
func AddrPolling ¶
AddrPolling returns an url for socket.io connection for polling transport
func AddrWebsocket ¶
AddrWebsocket returns an url for socket.io connection for websocket transport
func CountOverfloodingChannels ¶
func CountOverfloodingChannels() int
CountOverfloodingChannels returns an amount of overflooding channels
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
Channel represents socket.io connection
func (*Channel) Ack ¶
Ack a synchronous event with the given name and payload and wait for/receive the response
func (*Channel) Amount ¶
Amount returns an amount of channels joined to the given room, using channel
func (*Channel) BroadcastTo ¶
BroadcastTo the the given room an event with given name and payload, using channel
func (*Channel) RequestHeader ¶
RequestHeader returns a connection request connectionHeader
type Client ¶
type Client struct { *Channel // contains filtered or unexported fields }
Client represents socket.io client
type Server ¶
Server represents a socket.io server instance
func (*Server) BroadcastTo ¶
BroadcastTo the the given room an handler with payload, using server
func (*Server) BroadcastToAll ¶
Broadcast to all clients
func (*Server) CountChannels ¶
CountChannels returns an amount of connected channels
func (*Server) CountRooms ¶
CountRooms returns an amount of rooms with at least one joined channel
func (*Server) GetChannel ¶
GetChannel by it's sid