Documentation ¶
Overview ¶
package engine implements the [Engine.IO](https://socket.io/docs/v4/engine-io-protocol) protocol
Index ¶
- Constants
- Variables
- type Options
- type Packet
- type PacketType
- type Socket
- func (s *Socket) Close() error
- func (s *Socket) Conn() *websocket.Conn
- func (s *Socket) Connected() bool
- func (s *Socket) Context() context.Context
- func (s *Socket) Dial(ctx context.Context) (err error)
- func (s *Socket) Emit(body []byte)
- func (s *Socket) ID() string
- func (s *Socket) OnBinary(cb func(s *Socket, data []byte))
- func (s *Socket) OnConnect(cb func(s *Socket))
- func (s *Socket) OnDialError(cb func(s *Socket, err error))
- func (s *Socket) OnDisconnect(cb func(s *Socket, err error))
- func (s *Socket) OnMessage(cb func(s *Socket, data []byte))
- func (s *Socket) OnPong(cb func(s *Socket, data []byte))
- func (s *Socket) OnReconnect(cb func(s *Socket))
- func (s *Socket) OnRecv(cb func(s *Socket, data []byte))
- func (s *Socket) OnSend(cb func(s *Socket, data []byte))
- func (s *Socket) OnceBinary(cb func(s *Socket, data []byte))
- func (s *Socket) OnceConnect(cb func(s *Socket))
- func (s *Socket) OnceDisconnect(cb func(s *Socket, err error))
- func (s *Socket) OnceMessage(cb func(s *Socket, data []byte))
- func (s *Socket) OncePong(cb func(s *Socket, data []byte))
- func (s *Socket) Status() SocketStatus
- func (s *Socket) URL() *url.URL
- type SocketStatus
- type UnexpectedPacketTypeError
Constants ¶
View Source
const Protocol = 4
Variables ¶
View Source
var ( ErrSocketConnected = errors.New("Engine.IO: socket was already connected") ErrPingTimeout = errors.New("Engine.IO: did not receive PING packet for a long time") )
View Source
var DefaultOption = Options{ Secure: true, Path: "/engine.io/", }
View Source
var WebsocketDialer *websocket.Dialer = &websocket.Dialer{ Proxy: http.ProxyFromEnvironment, HandshakeTimeout: 30 * time.Second, }
Functions ¶
This section is empty.
Types ¶
type Packet ¶
type Packet struct {
// contains filtered or unexported fields
}
func (*Packet) MarshalBinary ¶
func (*Packet) Type ¶
func (p *Packet) Type() PacketType
func (*Packet) UnmarshalBinary ¶
func (*Packet) UnmarshalBody ¶
type PacketType ¶
type PacketType int8
const ( OPEN PacketType = iota CLOSE PING PONG MESSAGE UPGRADE NOOP BINARY PacketType = 'b' )
func (PacketType) ID ¶
func (t PacketType) ID() byte
func (PacketType) String ¶
func (t PacketType) String() string
type Socket ¶
func (*Socket) OnDialError ¶ added in v0.1.2
func (*Socket) OnDisconnect ¶
func (*Socket) OnReconnect ¶ added in v0.1.2
func (*Socket) OnceBinary ¶
func (*Socket) OnceConnect ¶
func (*Socket) OnceDisconnect ¶
func (*Socket) OnceMessage ¶
func (*Socket) Status ¶
func (s *Socket) Status() SocketStatus
type SocketStatus ¶
type SocketStatus = int32
const ( SocketClosed SocketStatus = iota SocketOpening SocketConnected )
type UnexpectedPacketTypeError ¶
type UnexpectedPacketTypeError struct {
Type PacketType
}
func (*UnexpectedPacketTypeError) Error ¶
func (e *UnexpectedPacketTypeError) Error() string
Click to show internal directories.
Click to hide internal directories.