Documentation ¶
Index ¶
Constants ¶
const DefaultEngineioPath = "/engine.io/"
Variables ¶
var ( ErrUnknownSession = errors.New("unknown session id") ErrQueueFull = errors.New("queue limit reached") ErrNotConnected = errors.New("not connected") )
var DefaultConfig = &Config{ QueueLength: 10, PingInterval: 25000, PingTimeout: 60000, Upgrades: []string{"websocket"}, }
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Maximum amount of messages to store for a connection. If a // connection has QueueLength amount of undelivered messages, // the following writes will return ErrQueueFull error. QueueLength int // The size of the read buffer in bytes. ReadBufferSize int // Ping/Ping interval in milliseconds. PingInterval int64 // Ping timeout in milliseconds. PingTimeout int64 // Upgrades to use. (Only websocket supported). Upgrades []string }
type Connection ¶
type Connection interface { io.WriteCloser ID() string // contains filtered or unexported methods }
type EngineIO ¶
type EngineIO struct {
// contains filtered or unexported fields
}
EngineIO handles transport abstraction and provide the user a handfull of callbacks to observe different events.
func NewEngineIO ¶
NewEngineIO allocates and returns a new EngineIO. If config is nil, the DefaultConfig is used.
func (*EngineIO) CloseFunc ¶
func (e *EngineIO) CloseFunc(fn func(Connection))
CloseFunc sets fn to be invoked when a session is considered to be lost. It passes the established connection as an argument to the callback. After disconnection the connection is considered to be destroyed, and it should not be used anymore.
func (*EngineIO) ConnectionFunc ¶
func (e *EngineIO) ConnectionFunc(fn func(Connection))
ConnectionFunc sets fn to be invoked when a new connection is established. It passes the established connection as an argument to the callback.
func (*EngineIO) MessageFunc ¶
func (e *EngineIO) MessageFunc(fn func(Connection, []byte) error)
MessageFunc sets fn to be invoked when a message arrives. It passes the established connection along with the received message datai as arguments to the callback.