mewbot / WsHandler
-
BaseEmitter
<{open
:void
;dispatch
:Dispatch
;close
:void
}>↳
WsHandler
• new WsHandler()
BaseEmitter<{ open: void, dispatch: Dispatch, close: void, }>.constructor
• Protected
_emitter: EventEmitter
BaseEmitter._emitter
• Protected
_ws: WebSocket
• Protected
_connectStatus: ConnectStatus
= ConnectStatus.None
• Protected
_heartbeatCheck: number
= -1
▸ on<K
>(eventName
, fn
): void
Name | Type |
---|---|
K |
extends EventKey <{ open : void ; dispatch : Dispatch ; close : void }> |
Name | Type |
---|---|
eventName |
K |
fn |
EventReceiver <{ open : void ; dispatch : Dispatch ; close : void }[K ]> |
void
BaseEmitter.on
▸ off<K
>(eventName
, fn
): void
Name | Type |
---|---|
K |
extends EventKey <{ open : void ; dispatch : Dispatch ; close : void }> |
Name | Type |
---|---|
eventName |
K |
fn |
EventReceiver <{ open : void ; dispatch : Dispatch ; close : void }[K ]> |
void
BaseEmitter.off
▸ Protected
emit<K
>(eventName
, params
): void
Name | Type |
---|---|
K |
extends EventKey <{ open : void ; dispatch : Dispatch ; close : void }> |
Name | Type |
---|---|
eventName |
K |
params |
{ open : void ; dispatch : Dispatch ; close : void }[K ] |
void
BaseEmitter.emit
▸ connect(options
, auth?
): void
Name | Type |
---|---|
options |
Partial <ConnectOptions > |
auth? |
Auth |
void
▸ Protected
retryConnection(options
): void
Name | Type |
---|---|
options |
ConnectOptions |
void
▸ Protected
checkHeartbeat(options
, timeout?
): void
Name | Type | Default value |
---|---|---|
options |
ConnectOptions |
undefined |
timeout |
number |
0 |
void
▸ Protected
parseDispatch(raw
): Dispatch
Name | Type |
---|---|
raw |
string |
▸ Protected
refineDispatch(raw
): void
Name | Type |
---|---|
raw |
Dispatch |
void
▸ close(): void
void