WebSocketAPI - v1.1.5-1 › Globals › "ws/wsClient" › wsClient
- wsClient
+ new wsClient(ws: WebSocket, request: ExpressRequest, client?: any): wsClient
Defined in lib/ws/wsClient.ts:25
Parameters:
| Name | Type |
|---|---|
ws |
WebSocket |
request |
ExpressRequest |
client? |
any |
Returns: wsClient
• WebSocket: WebSocket
Defined in lib/ws/wsClient.ts:21
• _index: number
Defined in lib/ws/wsClient.ts:24
• client: any
Defined in lib/ws/wsClient.ts:23
• events: FetchEvent[]
Defined in lib/ws/wsClient.ts:25
• request: ExpressRequest
Defined in lib/ws/wsClient.ts:22
▸ api(api: string): object
Defined in lib/ws/wsClient.ts:62
Send a api request to the client
Parameters:
| Name | Type | Description |
|---|---|---|
api |
string | The event name to send to client |
Returns: object
-
delete(
body: any,options?: requestOptions): Promise‹unknown› -
get(
body: any,options?: requestOptions): Promise‹unknown› -
post(
body: any,options?: requestOptions): Promise‹unknown› -
put(
body: any,options?: requestOptions): Promise‹unknown›
▸ fetch(api: string, body?: any, options?: requestOptions): Promise‹unknown›
Defined in lib/ws/wsClient.ts:102
Send a reverse fetch to the client.
This allows you to make a request to the connected client from the server or send updated data to the client when it comes available
Parameters:
| Name | Type | Description |
|---|---|---|
api |
string | The api event name to send |
body? |
any | the payload to send with the request |
options? |
requestOptions | the options for the request |
Returns: Promise‹unknown›
▸ newIndex(): number
Defined in lib/ws/wsClient.ts:155
Returns: number