websocketconnections

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package connections allows to handle the websocket connection to reload the clients when is needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configurer

type Configurer interface {
	// ResponseWriter allows set the request response received by the client.
	ResponseWriter(response http.ResponseWriter) error

	// Request allows set the request instance received by the client.
	Request(request *http.Request) error
}

Configurer defines the configurable options to build a new Connection instance.

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection models a connection to the client toghether a websocket.

It allows upgrade a request recived to initilize a websocket connection. Manage the connection lifecicle.

func New

func New(options ...func(Configurer) error) (*Connection, error)

New returns a websocketconnections.Connection instance with request and response instanced configured.

func (*Connection) Close

func (c *Connection) Close() error

Close disconnects and closes the websocket connection.

func (*Connection) Open

func (c *Connection) Open() error

Open upgrades the connection to establishment a websocket communication.

func (*Connection) Reload

func (c *Connection) Reload() error

Reload enables the sending of the reload message to the client.

func (*Connection) Start

func (c *Connection) Start() error

Start executes the go routines to begin to listen the messages and watch the status connection.

func (*Connection) Stop

func (c *Connection) Stop() error

Stop terminates with the watching and listening of the connection.

func (*Connection) UUID

func (c *Connection) UUID() string

UUID returns the uuid assiged to websocket connection.

Jump to

Keyboard shortcuts

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