Documentation ¶
Index ¶
- type Connection
- func (c *Connection) Close(writeWait time.Duration, graceful bool)
- func (c *Connection) Identifier() string
- func (c *Connection) Ping(writeWait time.Duration)
- func (c *Connection) PrepareRead(maxMessageSize int64, pongWait time.Duration)
- func (c *Connection) PrepareWrite(writeWait time.Duration)
- func (c *Connection) Read() ([]byte, error)
- func (c *Connection) Write(data []byte) error
- type Transport
- func (t *Transport) GetAddress() string
- func (t *Transport) Init()
- func (t *Transport) RegisterNewConnHandler(register func(conn model.Connection))
- func (t *Transport) Run() error
- func (t *Transport) Unregister(conn model.Connection)
- func (t *Transport) UnregisterConnHandler(unregister func(conn model.Connection))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a websocket connection
func NewConnection ¶
func NewConnection(conn *websocket.Conn) *Connection
NewConnection creates a new connection
func (*Connection) Close ¶
func (c *Connection) Close(writeWait time.Duration, graceful bool)
Close sends the websocket CloseMessage https://tools.ietf.org/html/rfc6455#section-5.5.1 graceful == false closes immediatly
func (*Connection) Identifier ¶
func (c *Connection) Identifier() string
Identifier of the connection
func (*Connection) Ping ¶
func (c *Connection) Ping(writeWait time.Duration)
Ping sends a ping message to the client
func (*Connection) PrepareRead ¶
func (c *Connection) PrepareRead(maxMessageSize int64, pongWait time.Duration)
PrepareRead prepares the websocket connection for reading
func (*Connection) PrepareWrite ¶
func (c *Connection) PrepareWrite(writeWait time.Duration)
PrepareWrite prepares the websocket connection for writing
func (*Connection) Read ¶
func (c *Connection) Read() ([]byte, error)
Read from the network connection
func (*Connection) Write ¶
func (c *Connection) Write(data []byte) error
Write to the network connection
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport represents the websocket context
func NewTransport ¶
NewTransport creates the websocket context
func (*Transport) RegisterNewConnHandler ¶
func (t *Transport) RegisterNewConnHandler(register func(conn model.Connection))
RegisterNewConnHandler is a callback for new connections
func (*Transport) Unregister ¶
func (t *Transport) Unregister(conn model.Connection)
Unregister callback
func (*Transport) UnregisterConnHandler ¶
func (t *Transport) UnregisterConnHandler(unregister func(conn model.Connection))
UnregisterConnHandler is a callback for closed connections