Documentation
¶
Index ¶
- Constants
- Variables
- 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 ¶
View Source
const ( OnConnection = "connection" OnDisconnection = "disconnection" OnError = "error" )
View Source
const (
HeaderForward = "X-Forwarded-For"
)
Variables ¶
View Source
var ( ErrorCallerNotFunc = errors.New("f is not function") ErrorCallerMaxOneValue = errors.New("f should return not more than one value") )
View Source
var ( ErrorSendTimeout = errors.New("Timeout") ErrorSocketOverflood = errors.New("Socket overflood") )
View Source
var ( ErrorServerNotSet = errors.New("Server not set") ErrorConnectionNotFound = errors.New("Connection not found") )
View Source
var (
ErrorWaiterNotFound = errors.New("Waiter not found")
)
View Source
var ErrorWrongHeader = errors.New("Wrong header")
Functions ¶
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
func (*Channel) BroadcastTo ¶
func (*Channel) RequestHeader ¶
Get request header of this connection
type Client ¶
type Client struct {
Channel
// contains filtered or unexported fields
}
type Header ¶
type Header struct {
Sid string `json:"sid"`
Upgrades []string `json:"upgrades"`
PingInterval int `json:"pingInterval"`
PingTimeout int `json:"pingTimeout"`
}
Header represents 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) GetChannel ¶
Get channel by its 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
Click to show internal directories.
Click to hide internal directories.