Skip to main content
Version: 5.x.x

Listener


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

Description

Defined in listener/listener.ts:8

Parameters

NameDetails

socket

Required

Socket<AdapterType>

listenerOptions

Optional

ListenerOptionsType<Endpoint, AdapterType>

Properties

connections

Description

Defined in listener/listener.ts:17

Type

Set<ConnectMethodType<AdapterType, Response>>

endpoint

Description

Defined in listener/listener.ts:14

Type

Endpoint

listenerOptions

Description

Defined in listener/listener.ts:21

Type

ListenerOptionsType<Endpoint, AdapterType>

options

Description

Defined in listener/listener.ts:16

Type

ExtractListenerOptionsType<AdapterType>

params

Description

Defined in listener/listener.ts:15

Type

ParamsType

socket

Description

Defined in listener/listener.ts:20

Type

Socket<AdapterType>

Methods

listen()

Description

Defined in listener/listener.ts:67

Return

(options: ExtractRouteParams<ExtractListenerEndpointType<Listener>> extends NegativeTypes ? {
callback: ListenerCallbackType<Adapter, ExtractListenerResponseType<Listener>>;
} : (ExtractListenerHasParams<Listener> extends false ? {
callback: ListenerCallbackType<Adapter, ExtractListenerResponseType<Listener>>;
params: ExtractRouteParams<ExtractListenerEndpointType<Listener>>;
} : {
callback: ListenerCallbackType<Adapter, ExtractListenerResponseType<Listener>>;
params: never;
})) => () => void

clone()

Preview

clone<Params>(options)

Description

Defined in listener/listener.ts:56

Parameters

NameDetails

options

Optional

Partial<ListenerOptionsType<Endpoint, AdapterType>>

Return

Listener<Response, Endpoint, AdapterType, Params>

onData()

Preview

onData(callback)

Description

Attach global logic to the received events

Defined in listener/listener.ts:51

Parameters

NameDetails

callback

Required

ConnectMethodType<AdapterType, Response>

Return

Listener<Response, Endpoint, AdapterType, HasParams>

setOptions()

Preview

setOptions(options)

Description

Defined in listener/listener.ts:28

Parameters

NameDetails

options

Required

ExtractListenerOptionsType<AdapterType>

Return

Listener<Response, Endpoint, AdapterType, HasParams>

setParams()

Preview

setParams(params)

Description

Defined in listener/listener.ts:32

Parameters

NameDetails

params

Required

ExtractRouteParams<Endpoint>

Return

Listener<Response, Endpoint, AdapterType, true>