websocket

package
v0.0.0-...-2525d98 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

func NewTransport(address string, port int) *Transport

NewTransport creates the websocket context

func (*Transport) GetAddress

func (t *Transport) GetAddress() string

GetAddress ...

func (*Transport) Init

func (t *Transport) Init()

Init ...

func (*Transport) RegisterNewConnHandler

func (t *Transport) RegisterNewConnHandler(register func(conn model.Connection))

RegisterNewConnHandler is a callback for new connections

func (*Transport) Run

func (t *Transport) Run() error

Run ...

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

Jump to

Keyboard shortcuts

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