Documentation ¶
Index ¶
- Constants
- Variables
- func AmountOfOverflooded() int64
- func GetUrl(host string, port int, secure bool) string
- type Channel
- func (c *Channel) Ack(method string, args interface{}, timeout time.Duration) (string, error)
- func (c *Channel) Amount(room string) int
- func (c *Channel) BroadcastTo(room, method string, args interface{})
- func (c *Channel) Close()
- func (c *Channel) Emit(method string, args interface{}) error
- func (c *Channel) Id() string
- func (c *Channel) Ip() 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) Request() *http.Request
- func (c *Channel) RequestHeader() http.Header
- type Client
- type Header
- type Server
- func (s *Server) AddHeader(name string, value string)
- func (s *Server) Amount(room string) int
- func (s *Server) AmountOfRooms() int64
- func (s *Server) AmountOfSids() int64
- func (s *Server) BroadcastTo(room, method string, args interface{})
- func (s *Server) BroadcastToAll(method string, args interface{})
- func (s *Server) EnableCORS(domain string)
- func (s *Server) GetChannel(sid string) (*Channel, error)
- func (s *Server) List(room string) []*Channel
- func (m *Server) On(method string, f interface{}) error
- func (s *Server) SendOpenSequence(c *Channel)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetupEventLoop(conn transport.Connection, remoteAddr string, r *http.Request)
- func (s *Server) UpdateTransport(tr transport.Transport)
Constants ¶
const ( OnConnection = "connection" OnDisconnection = "disconnection" OnError = "error" )
const (
HeaderForward = "X-Forwarded-For"
)
Variables ¶
var ( ErrorCallerNotFunc = errors.New("f is not function") ErrorCallerNot2Args = errors.New("f should have 1 or 2 args") ErrorCallerMaxOneValue = errors.New("f should return not more than one value") )
var ( ErrorSendTimeout = errors.New("Timeout") ErrorSocketOverflood = errors.New("Socket overflood") )
var ( ErrorServerNotSet = errors.New("Server not set") ErrorConnectionNotFound = errors.New("Connection not found") )
var (
ErrorWaiterNotFound = errors.New("Waiter not found")
)
var (
ErrorWrongHeader = errors.New("Wrong header")
)
Functions ¶
func AmountOfOverflooded ¶
func AmountOfOverflooded() int64
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
* socket.io connection handler
use IsAlive to check that handler is still working use Dial to connect to websocket use In and Out channels for message exchange Close message means channel is closed ping is automatic
func (*Channel) BroadcastTo ¶
func (*Channel) RequestHeader ¶
* Get request header of this connection
type Client ¶
type Client struct { Channel // contains filtered or unexported fields }
* Socket.io client representation
type Header ¶
type Header struct { Sid string `json:"sid"` Upgrades []string `json:"upgrades"` PingInterval int `json:"pingInterval"` PingTimeout int `json:"pingTimeout"` }
* engine.io header to send or receive
type Server ¶
* socket.io server instance
func (*Server) AmountOfRooms ¶
* Get amount of rooms with at least one channel(or sid) joined
func (*Server) AmountOfSids ¶
* Get amount of current connected sids
func (*Server) BroadcastTo ¶
* Broadcast message to all room channels
func (*Server) BroadcastToAll ¶
* Broadcast to all clients
func (*Server) EnableCORS ¶
* Enables CORS for all domains
func (*Server) GetChannel ¶
* Get channel by it's sid
func (*Server) SendOpenSequence ¶
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
* implements ServeHTTP function from http.Handler
func (*Server) SetupEventLoop ¶
* Setup event loop for given connection
func (*Server) UpdateTransport ¶
* Replaces the pre-configured transport