Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultWebsocketPongTimeout 60 * time.Second DefaultWebsocketPongTimeout = 60 * time.Second // DefaultWebsocketPingPeriod (DefaultPongTimeout * 9) / 10 DefaultWebsocketPingPeriod = (DefaultWebsocketPongTimeout * 9) / 10 // DefaultWebsocketMaxMessageSize 10240000 DefaultWebsocketMaxMessageSize = 10240000 // DefaultWebsocketReadBufferSize 4096 DefaultWebsocketReadBufferSize = 4096 // DefaultWebsocketWriterBufferSize 4096 DefaultWebsocketWriterBufferSize = 4096 // DefaultEvtMessageKey is the default prefix of the underline websocket topics // that are being established under the hoods. // // Defaults to ":". // Last character of the prefix should be ':'. DefaultEvtMessageKey = "ws" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// URL is the target
Host string
// ID used to create the client id
ID string
// EvtMessagePrefix prefix of the every message
EvtMessagePrefix []byte
// WriteTimeout time allowed to write a message to the connection.
// 0 means no timeout.
// Default value is 0
// ReadTimeout time allowed to read a message from the connection.
// 0 means no timeout.
// Default value is 0
// PingPeriod send ping messages to the connection within this period. Must be less than PongTimeout.
// Default value is 60 *time.Second
PingPeriod time.Duration
// MaxMessageSize max message size allowed from connection.
// Default value is 1024
MaxMessageSize int64
// BinaryMessages set it to true in order to denotes binary data messages instead of utf-8 text
// compatible if you wanna use the Connection's EmitMessage to send a custom binary data to the client, like a native server-client communication.
// Default value is false
BinaryMessages bool
// ReadBufferSize is the buffer size for the connection reader.
// Default value is 4096
ReadBufferSize int
// WriteBufferSize is the buffer size for the connection writer.
// Default value is 4096
WriteBufferSize int
}
type ConnectFunc ¶
type ConnectFunc func()
type Connection ¶
type DisconnectFunc ¶
type DisconnectFunc func()
DisconnectFunc is the callback which is fired when the ws client closed.
Click to show internal directories.
Click to hide internal directories.