Documentation ¶
Index ¶
- Constants
- Variables
- func AmountOfOverflooded() int64
- func GetUrl(host string, port int, auth string, 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) RequestHeader() http.Header
- func (c *Channel) RequestURL() *url.URL
- type Client
- type Header
- type Server
- 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) 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, requestHeader http.Header, ...)
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") ErrorCallerNot2Args = errors.New("f should have 1 or 2 args") 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 ¶
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
func (*Channel) RequestURL ¶
* Get request url 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) 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 ¶
func (s *Server) SetupEventLoop(conn transport.Connection, remoteAddr string, requestHeader http.Header, requestURL *url.URL)
* Setup event loop for given connection
Source Files ¶
Click to show internal directories.
Click to hide internal directories.