websocket

package
v0.87.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const IncomingSocketName = "IncomingSocketName"

IncomingSocketName is the name of the incoming socket.

View Source
const OutgoingSocketName = "OutgoingSocket"

OutgoingSocketName is the name of the outgoing socket.

View Source
const WebsocketNexusName = "WebsocketNexus"

WebsocketNexusName is a websocket nexus.

Variables

This section is empty.

Functions

This section is empty.

Types

type IncomingSocket

type IncomingSocket struct {
	server.WebSocketServerProtocol

	// FactoryMsProtocolLayer protocol layer correspond to the socket interface
	FactoryMsProtocolLayer layer.Base
	// FactoryMsSharedSeed is the sahred seed
	FactoryMsSharedSeed *beacon.SharedSeed
	// contains filtered or unexported fields
}

IncomingSocket creates a new socket.

func NewIncomingSocket

func NewIncomingSocket() *IncomingSocket

NewIncomingSocket creates a new incoming websocket nexus (accepts request).

func (IncomingSocket) GetDownwardNexusList added in v0.12.0

func (i IncomingSocket) GetDownwardNexusList() []nexusHelper.Nexus

GetDownwardNexusList gets a nexus list.

func (*IncomingSocket) InitiateClose

func (i *IncomingSocket) InitiateClose()

InitiateClose closes the socket.

func (IncomingSocket) IsEqual added in v0.12.0

func (i IncomingSocket) IsEqual(n nexusHelper.Nexus) bool

IsEqual is an IncomingSocket handler.

func (*IncomingSocket) Name added in v0.12.0

func (i *IncomingSocket) Name() string

Name gets the name.

func (*IncomingSocket) OnBinMessage

func (i *IncomingSocket) OnBinMessage(belowNexus nexusHelper.Nexus, msg []byte)

OnBinMessage corresponds to the nexus interface, handles a binary message.

func (*IncomingSocket) OnClose

func (i *IncomingSocket) OnClose(wasClean bool, code int, reason string)

OnClose closes the websocket.

func (IncomingSocket) OnConnect

func (i IncomingSocket) OnConnect(r *http.Request)

OnConnect creates a IncomingSocket client connection.

func (IncomingSocket) OnConnecting

func (i IncomingSocket) OnConnecting(r *http.Request)

OnConnecting starts an IncomingSocket connection.

func (*IncomingSocket) OnMessage

func (i *IncomingSocket) OnMessage(belowNexus nexusHelper.Nexus, moneysocketMessage base2.MoneysocketMessage)

OnMessage corresponds to the nexus interface, handles a message.

func (*IncomingSocket) OnOpen

func (i *IncomingSocket) OnOpen()

OnOpen opens an IncomingSocket.

func (*IncomingSocket) OnWsMessage

func (i *IncomingSocket) OnWsMessage(payload []byte, isBinary bool)

OnWsMessage processes a websocket message.

func (*IncomingSocket) Send

Send sends a message.

func (*IncomingSocket) SendBin

func (i *IncomingSocket) SendBin(rawMsg []byte) error

SendBin sends a binary message.

func (*IncomingSocket) ServeHTTP

func (i *IncomingSocket) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves an http request.

func (*IncomingSocket) SetOnBinMessage added in v0.12.0

func (i *IncomingSocket) SetOnBinMessage(messageBinFunc nexusHelper.OnBinMessage)

SetOnBinMessage sets the binary message handler for the IncomingSocket.

func (*IncomingSocket) SetOnMessage added in v0.12.0

func (i *IncomingSocket) SetOnMessage(messageFunc nexusHelper.OnMessage)

SetOnMessage sets the message handler for an IncomingSocket.

func (*IncomingSocket) SharedSeed

func (i *IncomingSocket) SharedSeed() *beacon.SharedSeed

SharedSeed gets the shared seed from the IncomingSocket.

func (IncomingSocket) UUID added in v0.53.0

func (i IncomingSocket) UUID() uuid.UUID

UUID gets the uuid of the IncomingSocket.

type Nexus added in v0.54.0

type Nexus struct {
	*base.NexusBase
}

Nexus is a nexus.

func NewWebsocketNexus

func NewWebsocketNexus(belowNexus nexus.Nexus, layer layer.Base) *Nexus

NewWebsocketNexus creates a websocket nexus.

func (*Nexus) OnBinMessage added in v0.54.0

func (o *Nexus) OnBinMessage(belowNexus nexus.Nexus, msgByte []byte)

OnBinMessage processes a binary message.

func (*Nexus) OnMessage added in v0.54.0

func (o *Nexus) OnMessage(belowNexus nexus.Nexus, msg base2.MoneysocketMessage)

OnMessage processes a nexus message.

type OutgoingSocket

type OutgoingSocket struct {
	client.WebsocketClientProtocol

	// FactoryMsProtocolLayer protocol layer coorespond to the socket interface
	FactoryMsProtocolLayer layer.Base
	// OutgoingSharedSeed adds an outgoing shared seed modules
	OutgoingSharedSeed *beacon.SharedSeed
	// contains filtered or unexported fields
}

OutgoingSocket is the outgoing socket.

func NewOutgoingSocket

func NewOutgoingSocket() *OutgoingSocket

NewOutgoingSocket creates a new incoming websocket nexus (accepts request).

func (*OutgoingSocket) GetDownwardNexusList added in v0.13.0

func (i *OutgoingSocket) GetDownwardNexusList() []nexusHelper.Nexus

nolint

func (*OutgoingSocket) InitiateClose added in v0.13.0

func (i *OutgoingSocket) InitiateClose()

nolint

func (*OutgoingSocket) IsEqual added in v0.13.0

func (i *OutgoingSocket) IsEqual(n nexusHelper.Nexus) bool

nolint

func (*OutgoingSocket) Name added in v0.13.0

func (i *OutgoingSocket) Name() string

nolint

func (*OutgoingSocket) OnBinMessage

func (i *OutgoingSocket) OnBinMessage(belowNexus nexusHelper.Nexus, msg []byte)

OnBinMessage corresponds to the nexus interface, handles a binary message.

func (*OutgoingSocket) OnClose

func (i *OutgoingSocket) OnClose(wasClean bool, code int, reason string)

nolint

func (OutgoingSocket) OnConnect

func (i OutgoingSocket) OnConnect(conn *websocket.Conn, r *http.Response)

OnConnect manages a websocket connection.

func (OutgoingSocket) OnConnecting

func (i OutgoingSocket) OnConnecting()

OnConnecting is a connecting websocket event.

func (*OutgoingSocket) OnMessage

OnMessage corresponds to the nexus interface, handles a message.

func (*OutgoingSocket) OnOpen

func (i *OutgoingSocket) OnOpen()

OnOpen opens a websocket connection.

func (*OutgoingSocket) OnWsMessage

func (i *OutgoingSocket) OnWsMessage(payload []byte, isBinary bool)

OnWsMessage processes a websocket message.

func (*OutgoingSocket) Send

Send sends a message.

func (*OutgoingSocket) SendBin

func (i *OutgoingSocket) SendBin(msg []byte) error

SendBin sends a binary message.

func (*OutgoingSocket) SetOnBinMessage added in v0.13.0

func (i *OutgoingSocket) SetOnBinMessage(messageBinFunc nexusHelper.OnBinMessage)

nolint

func (*OutgoingSocket) SetOnMessage added in v0.13.0

func (i *OutgoingSocket) SetOnMessage(messageFunc nexusHelper.OnMessage)

nolint

func (*OutgoingSocket) SharedSeed

func (i *OutgoingSocket) SharedSeed() *beacon.SharedSeed

SharedSeed gets the shared seed of the outgoing socket.

func (*OutgoingSocket) UUID added in v0.53.0

func (i *OutgoingSocket) UUID() uuid.UUID

nolint

Jump to

Keyboard shortcuts

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