wsprotocol

package
v0.0.0-...-1293670 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2016 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func (Dialer) Dial

func (d Dialer) Dial(url string, r Router) (*request.Context, error)

Dial connects to a websocket endpoint and creates a Connection

type Router

type Router interface {
	OnNewConnection(request.AsyncSenderCloser, <-chan dtos.WebSocketMessage) *request.Context
}

Router handles incoming Messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL