Skip to main content
Version: 2.x.x

SocketClient


import { SocketClient } from "@hyper-fetch/sockets"

Description

Defined in client/client.ts:8

Parameters

NameDetails

socket

Required

SocketType

Properties

client

Description

Defined in client/client.ts:9

Type

WebSocket | EventSource

connecting

Description

Defined in client/client.ts:12

Type

boolean

forceClosed

Description

Defined in client/client.ts:13

Type

boolean

listeners

Description

Defined in client/client.ts:10

Type

Map<string, Set<ListenerCallbackType<any>>>

logger

Description

Defined in client/client.ts:19

Type

LoggerType

open

Description

Defined in client/client.ts:11

Type

boolean

pingTimer

Description

Defined in client/client.ts:15

Type

Timeout

pongTimer

Description

Defined in client/client.ts:16

Type

Timeout

reconnectionAttempts

Description

Defined in client/client.ts:14

Type

number

socket

Description

Defined in client/client.ts:21

Type

SocketType

Methods

init()

Description

Defined in client/client.ts:18

Return

() => WebSocket | EventSource

clearTimers()

Preview

clearTimers()

Description

Defined in client/client.ts:147

Return

void

connect()

Preview

connect()

Description

Defined in client/client.ts:38

Return

void

disconnect()

Preview

disconnect()

Description

Defined in client/client.ts:111

Return

void

emit()

Preview

emit(eventMessageId, emitter, ack)

Description

Defined in client/client.ts:202

Parameters

NameDetails

eventMessageId

Required

string

emitter

Required

EmitterInstance

ack

Optional

(error: Error, response: any) => void

Return

Promise<void>

heartbeat()

Preview

heartbeat()

Description

Defined in client/client.ts:158

Return

void

listen()

Preview

listen(listener, callback)

Description

Defined in client/client.ts:194

Parameters

NameDetails

listener

Required

Pick<ListenerInstance, name>

callback

Required

(...args: any[]) => void

Return

() => boolean

reconnect()

Preview

reconnect()

Description

Defined in client/client.ts:127

Return

boolean

removeListener()

Preview

removeListener(event, callback)

Description

Defined in client/client.ts:183

Parameters

NameDetails

event

Required

string

callback

Required

(...args: any[]) => void

Return

boolean

sendEventMessage()

Preview

sendEventMessage(payload)

Description

Defined in client/client.ts:152

Parameters

NameDetails

payload

Required

WSMessageType

Return

void