Skip to main content
Version: 3.x.x

SocketAdapter


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

Description

Defined in adapter/adapter.ts:8

Parameters

NameDetails

socket

Required

SocketType

Properties

adapter

Description

Defined in adapter/adapter.ts:9

Type

WebSocket | EventSource

connecting

Description

Defined in adapter/adapter.ts:12

Type

boolean

forceClosed

Description

Defined in adapter/adapter.ts:13

Type

boolean

listeners

Description

Defined in adapter/adapter.ts:10

Type

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

logger

Description

Defined in adapter/adapter.ts:19

Type

LoggerType

open

Description

Defined in adapter/adapter.ts:11

Type

boolean

pingTimer

Description

Defined in adapter/adapter.ts:15

Type

Timeout

pongTimer

Description

Defined in adapter/adapter.ts:16

Type

Timeout

reconnectionAttempts

Description

Defined in adapter/adapter.ts:14

Type

number

socket

Description

Defined in adapter/adapter.ts:21

Type

SocketType

Methods

init()

Description

Defined in adapter/adapter.ts:18

Return

() => WebSocket | EventSource

clearTimers()

Preview

clearTimers()

Description

Defined in adapter/adapter.ts:153

Return

void

connect()

Preview

connect()

Description

Defined in adapter/adapter.ts:38

Return

void

disconnect()

Preview

disconnect()

Description

Defined in adapter/adapter.ts:117

Return

void

emit()

Preview

emit(eventMessageId, emitter, ack)

Description

Defined in adapter/adapter.ts:208

Parameters

NameDetails

eventMessageId

Required

string

emitter

Required

EmitterInstance

ack

Optional

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

Return

Promise<void>

heartbeat()

Preview

heartbeat()

Description

Defined in adapter/adapter.ts:164

Return

void

listen()

Preview

listen(listener, callback)

Description

Defined in adapter/adapter.ts:200

Parameters

NameDetails

listener

Required

Pick<ListenerInstance, name>

callback

Required

(data: any, event: MessageEvent<any>) => void

Return

() => boolean

reconnect()

Preview

reconnect()

Description

Defined in adapter/adapter.ts:133

Return

boolean

removeListener()

Preview

removeListener(event, callback)

Description

Defined in adapter/adapter.ts:189

Parameters

NameDetails

event

Required

string

callback

Required

(data: any, event: MessageEvent<any>) => void

Return

boolean

sendEventMessage()

Preview

sendEventMessage(payload)

Description

Defined in adapter/adapter.ts:158

Parameters

NameDetails

payload

Required

WSMessageType

Return

void