Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ConnectionTimeout is the default connection timeout ConnectionTimeout = 5 * time.Second // ReplyTimeout is the default timeout of reply messages ReplyTimeout = 5 * time.Second // DefaultPingInterval is the default keepalive ping interval DefaultPingInterval = 20 * time.Second // InitialReconnectInterval is the initial (minimal) reconnect interval InitialReconnectInterval = time.Second // MaxReconnectInterval is the maximum reconnect interval MaxReconnectInterval = time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is the single connection to SocketIO server.
func Open ¶
func Open(url string, options ...Option) *Connection
Open creates a new connection to SocketIO server
func (*Connection) Close ¶
func (c *Connection) Close()
Close closes the connection and stops the reconnect cycle.
func (*Connection) Connected ¶
func (c *Connection) Connected() <-chan struct{}
Connected returns the channel of 'connected' events.
func (*Connection) Messages ¶
func (c *Connection) Messages() <-chan IncomingMessage
Messages returns the channel of incoming messages.
type IncomingMessage ¶
type IncomingMessage struct {
Type string
Payload json.RawMessage
}
IncomingMessage represents an incoming message from SocketIO server
func (*IncomingMessage) UnmarshalJSON ¶
func (m *IncomingMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler for IncomingMessage.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option allows to configure Connection on create.
func WithLogger ¶
WithLogger allows to configure log of the connection.
Click to show internal directories.
Click to hide internal directories.