WebSocketAPI - v1.1.5-1 › Globals › "index"
▸ on(name: string, callback?: undefined | function): eventObject
Defined in lib/index.ts:95
Register a event listener for the name.
Events are called when a event gets dispatched with that same name
example on("test", () => {/Always run /}).get(() => {/ Get request /}).post(() => {/* post request */})
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | the event name |
callback? |
undefined | function | the callback to run |
Returns: eventObject
▸ register(app: Application, wss: Server, route: string, options: Partial‹SettingsInterface›): void
Defined in lib/index.ts:66
Register the default route with express
Parameters:
| Name | Type | Description |
|---|---|---|
app |
Application | Express app |
wss |
Server | the web-wss connection |
route |
string | the default route |
options |
Partial‹SettingsInterface› | - |
Returns: void
▸ triggerSnapshot(api: string, extra: any): void
Defined in lib/index.ts:149
Trigger a update event for any registered listeners
Parameters:
| Name | Type | Description |
|---|---|---|
api |
string | the api name to update for |
extra |
any | the data to add |
Returns: void
Defined in lib/index.ts:50
the default settings object
• maxLength: number = 100000
Defined in lib/index.ts:51
▪ on: object
Defined in lib/index.ts:52
-
eventCompleted(): void
-
eventReceived(): void