Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultDialer = Dialer{dtos.JSONMessageMarshaller{}}
DefaultDialer uses the default marshaller
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection wraps the websocket connection
func (*Connection) Close ¶
func (c *Connection) Close()
Close attempts to send a proper close to the client. If the connection is in an invalid state, this will fail, however, all the necessary cleanup will be performed properly anyway.
func (*Connection) SendAsync ¶
func (c *Connection) SendAsync(msg dtos.WebSocketMessage) (channel <-chan error)
SendAsync sends a WebSocketMessage asynchronously and returns immediately if an error is encountered or the message write has been enqueued. If an error is encountered during the network transfer, the error is passed through the returned channel. If there is no error, nil is sent on that channel
type ConnectionUpgrader ¶
type ConnectionUpgrader struct {
// contains filtered or unexported fields
}
ConnectionUpgrader upgrades an incomming HTTP connection to a websocket connection and constructs necessary structures
func NewConnectionUpgrader ¶
func NewConnectionUpgrader(m dtos.WebSocketMessageMarshaller, r Router) *ConnectionUpgrader
NewConnectionUpgrader creates a valid new instance of a ConnectionManager
func (*ConnectionUpgrader) HandleWSConnection ¶
func (c *ConnectionUpgrader) HandleWSConnection(w http.ResponseWriter, r *http.Request)
HandleWSConnection handles the upgrade to a websocket connection and performs authentication using the wsserver.WebSocketAuthenticator interface. Satisfies the http.HandlerFunc interface.
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer allows establishing and configuring a websocket connection
type Router ¶
type Router interface {
OnNewConnection(request.AsyncSenderCloser, <-chan dtos.WebSocketMessage) *request.Context
}
Router handles incoming Messages