Skip to main content

foundation-comms.socket

Home > @genesislcap/foundation-comms > Socket

Socket interface

Represents a WebSocket used to establish a communication channel between client and a Genesis server. Provides methods for socket connection, sending and receiving WS messages.

Signature:

export interface Socket extends Omit<SocketStatus, 'serialize' | 'onClose' | 'reconnectionLimitReached' | 'closedCode' | 'closedReason' | 'closedClean'> 

Extends: Omit<SocketStatus, 'serialize' | 'onClose' | 'reconnectionLimitReached' | 'closedCode' | 'closedReason' | 'closedClean'>

Properties

Property

Modifiers

Type

Description

host

string

Methods

Method

Description

connect(host, options, reconnectOptions)

reset()

Disconnects the socket and clears all subscriptions

send(message, needsHandling)

sendForStream(message, onMessage, onError, onComplete)

sendForStreamWithoutTeardown(message, onMessage, onError)

(ALPHA) Sends a message and returns an observable that emits messages received from the server.

socketMessages()