Skip to main content

@terascope/teraslice-messaging / messenger/server / Server

Class: Server

Extends

Extended by

Constructors

new Server()

new Server(opts): Server

Parameters

ParameterType
optsServerOptions

Returns

Server

Overrides

Core.constructor

Source

messenger/server.ts:35

Properties

_clients

protected _clients: ConnectedClients

Source

messenger/server.ts:33


actionTimeout

protected actionTimeout: number

Inherited from

Core.actionTimeout

Source

messenger/core.ts:15


clientDisconnectTimeout

readonly clientDisconnectTimeout: number

Source

messenger/server.ts:31


closed

closed: boolean = false

Inherited from

Core.closed

Source

messenger/core.ts:12


httpServer

readonly httpServer: Server<typeof IncomingMessage, typeof ServerResponse>

Source

messenger/server.ts:29


isShuttingDown

isShuttingDown: boolean

Source

messenger/server.ts:26


logger

protected logger: Logger

Inherited from

Core.logger

Source

messenger/core.ts:16


networkLatencyBuffer

protected networkLatencyBuffer: number

Inherited from

Core.networkLatencyBuffer

Source

messenger/core.ts:14


port

readonly port: number

Source

messenger/server.ts:27


server

readonly server: Server

Source

messenger/server.ts:28


serverName

readonly serverName: string

Source

messenger/server.ts:30

Accessors

availableClientCount

get availableClientCount(): number

Returns

number

Source

messenger/server.ts:190


availableClients

get availableClients(): ConnectedClient[]

Returns

ConnectedClient[]

Source

messenger/server.ts:186


disconnectedClientCount

get disconnectedClientCount(): number

Returns

number

Source

messenger/server.ts:182


disconnectedClients

get disconnectedClients(): ConnectedClient[]

Returns

ConnectedClient[]

Source

messenger/server.ts:178


onlineClientCount

get onlineClientCount(): number

Returns

number

Source

messenger/server.ts:174


onlineClients

get onlineClients(): ConnectedClient[]

Returns

ConnectedClient[]

Source

messenger/server.ts:170


unavailableClientCount

get unavailableClientCount(): number

Returns

number

Source

messenger/server.ts:198


unavailableClients

get unavailableClients(): ConnectedClient[]

Returns

ConnectedClient[]

Source

messenger/server.ts:194

Methods

close()

close(): void

Returns

void

Inherited from

Core.close

Source

messenger/core.ts:38


emit()

emit(eventName, msg): void

Parameters

ParameterType
eventNamestring
msgEventMessage

Returns

void

Inherited from

Core.emit

Source

messenger/core.ts:132


ensureClient()

protected ensureClient(socket): ConnectedClient

Parameters

ParameterType
socketSocket

Returns

ConnectedClient

Source

messenger/server.ts:361


getClientMetadataFromSocket()

protected getClientMetadataFromSocket(socket): ClientSocketMetadata

Parameters

ParameterType
socketSocket

Returns

ClientSocketMetadata

Source

messenger/server.ts:307


getTimeout()

getTimeout(timeout?): number

Parameters

ParameterType
timeout?number

Returns

number

Inherited from

Core.getTimeout

Source

messenger/core.ts:127


getTimeoutWithMax()

getTimeoutWithMax(maxTimeout): number

Parameters

ParameterType
maxTimeoutnumber

Returns

number

Inherited from

Core.getTimeoutWithMax

Source

messenger/core.ts:122


handleResponse()

protected handleResponse(socket, eventName, fn): void

Parameters

ParameterType
socketSocketEmitter
eventNamestring
fnMessageHandler

Returns

void

Inherited from

Core.handleResponse

Source

messenger/core.ts:64


handleSendResponse()

protected handleSendResponse(sent): Promise<null | Message>

Parameters

ParameterType
sentMessage

Returns

Promise<null | Message>

Inherited from

Core.handleSendResponse

Source

messenger/core.ts:43


isClientConnected()

isClientConnected(clientId): boolean

Parameters

ParameterType
clientIdstring

Returns

boolean

Source

messenger/server.ts:301


isClientReady()

isClientReady(clientId): boolean

Parameters

ParameterType
clientIdstring

Returns

boolean

Overrides

Core.isClientReady

Source

messenger/server.ts:244


listen()

listen(): Promise<void>

Returns

Promise<void>

Source

messenger/server.ts:96


onClientAvailable()

onClientAvailable(fn): this

Parameters

ParameterType
fn(clientId) => void

Returns

this

Source

messenger/server.ts:208


onClientDisconnect()

onClientDisconnect(fn): this

Parameters

ParameterType
fn(clientId) => void

Returns

this

Source

messenger/server.ts:220


onClientError()

onClientError(fn): this

Parameters

ParameterType
fn(clientId) => void

Returns

this

Source

messenger/server.ts:238


onClientOnline()

onClientOnline(fn): this

Parameters

ParameterType
fn(clientId) => void

Returns

this

Source

messenger/server.ts:202


onClientReconnect()

onClientReconnect(fn): this

Parameters

ParameterType
fn(clientId) => void

Returns

this

Source

messenger/server.ts:232


onClientShutdown()

onClientShutdown(fn): this

Parameters

ParameterType
fn(clientId) => void

Returns

this

Source

messenger/server.ts:226


onClientUnavailable()

onClientUnavailable(fn): this

Parameters

ParameterType
fn(clientId) => void

Returns

this

Source

messenger/server.ts:214


onceWithTimeout()

onceWithTimeout(eventName, timeout?): Promise<any>

Parameters

ParameterType
eventNamestring
timeout?number

Returns

Promise<any>

Inherited from

Core.onceWithTimeout

Source

messenger/core.ts:139


send()

protected send(clientId, eventName, payload, options): Promise<null | Message>

Parameters

ParameterType
clientIdstring
eventNamestring
payloadPayload
optionsSendOptions

Returns

Promise<null | Message>

Source

messenger/server.ts:260


sendToAll()

protected sendToAll(eventName, payload?, options?): Promise<(null | Message)[]>

Parameters

ParameterType
eventNamestring
payload?Payload
options?SendOptions

Returns

Promise<(null | Message)[]>

Source

messenger/server.ts:249


shutdown()

shutdown(): Promise<void>

Returns

Promise<void>

Source

messenger/server.ts:148


updateClientState()

protected updateClientState(clientId, state): boolean

Parameters

ParameterType
clientIdstring
stateClientState

Returns

boolean

Source

messenger/server.ts:328


waitForClientReady()

waitForClientReady(clientId, timeout?): Promise<boolean>

Parameters

ParameterType
clientIdstring
timeout?number

Returns

Promise<boolean>

Inherited from

Core.waitForClientReady

Source

messenger/core.ts:108