Skip to content

Latest commit

 

History

History
143 lines (79 loc) · 3.43 KB

File metadata and controls

143 lines (79 loc) · 3.43 KB

WebSocketAPI - v1.1.5-1Globals"client/socket"

Module: "client/socket"

Index

Type aliases

Variables

Functions

Type aliases

stateChangeEvent

Ƭ stateChangeEvent: "OPEN" | "CLOSED" | "ERROR" | "READY" | "AUTHFAILED"

Defined in lib/client/socket.ts:18

Variables

Let ready

ready: Boolean = false

Defined in lib/client/socket.ts:22


Let socket

socket: WebSocket | null = null

Defined in lib/client/socket.ts:21


Const stateChangeEvents

stateChangeEvents: function[] = []

Defined in lib/client/socket.ts:19

Functions

fetch

fetch(id: number, api: string, body?: any, options?: requestOptions): Promise‹RequestData

Defined in lib/client/socket.ts:213

Create a fetch request from the server

Parameters:

Name Type Description
id number The data request id
api string the api endpoint
body? any the body to send to the server
options? requestOptions options for the request

Returns: Promise‹RequestData


registerSnapshot

registerSnapshot(id: number, api: string, body: any, callback: function): unregister

Defined in lib/client/socket.ts:260

Register a event to fire each time that id gets sent

Returns a function to unregister the event

Parameters:

id: number

the event id to use

api: string

the api string

body: any

the request body to send to the server

callback: function

the callback to run on each message

▸ (data: RequestData): void

Parameters:

Name Type
data RequestData

Returns: unregister


send

send(body: object): void

Defined in lib/client/socket.ts:297

Send a payload to the server

Parameters:

Name Type Description
body object The data to send to the server

Returns: void


setup

setup(): void

Defined in lib/client/socket.ts:24

Returns: void