@nomalism-com/api 0.45.18 → 0.45.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -139,6 +139,7 @@ var Service = class {
|
|
|
139
139
|
}
|
|
140
140
|
openSocket({
|
|
141
141
|
token,
|
|
142
|
+
channel,
|
|
142
143
|
onEvent,
|
|
143
144
|
onOpen,
|
|
144
145
|
onReconnect,
|
|
@@ -151,7 +152,7 @@ var Service = class {
|
|
|
151
152
|
let pingTimer = null;
|
|
152
153
|
let reconnectTimer = null;
|
|
153
154
|
let closedByCaller = false;
|
|
154
|
-
const
|
|
155
|
+
const subprotocols = channel ? [`bearer.${token}`, `channel.${channel}`] : [`bearer.${token}`];
|
|
155
156
|
const stopPing = () => {
|
|
156
157
|
if (pingTimer !== null) {
|
|
157
158
|
window.clearInterval(pingTimer);
|
|
@@ -179,7 +180,7 @@ var Service = class {
|
|
|
179
180
|
const connect = () => {
|
|
180
181
|
if (closedByCaller) return;
|
|
181
182
|
try {
|
|
182
|
-
ws = new WebSocket(this.route,
|
|
183
|
+
ws = new WebSocket(this.route, subprotocols);
|
|
183
184
|
} catch (err) {
|
|
184
185
|
console.error("WebSocket constructor threw", err);
|
|
185
186
|
scheduleReconnect();
|
|
@@ -3,5 +3,5 @@ import type { IModuleConstructor } from '../../main';
|
|
|
3
3
|
export default class Service implements Nomalism.WebSocket.IClient {
|
|
4
4
|
route: string;
|
|
5
5
|
constructor({ route }: IModuleConstructor);
|
|
6
|
-
openSocket<T extends Nomalism.WebSocket.IEvent>({ token, onEvent, onOpen, onReconnect, onClose, onAuthUnverified, }: Nomalism.WebSocket.SocketOptions<T>): Nomalism.WebSocket.SocketHandle;
|
|
6
|
+
openSocket<T extends Nomalism.WebSocket.IEvent>({ token, channel, onEvent, onOpen, onReconnect, onClose, onAuthUnverified, }: Nomalism.WebSocket.SocketOptions<T>): Nomalism.WebSocket.SocketHandle;
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nomalism-com/api",
|
|
3
3
|
"description": "A nomalism API package for performing HTTP requests on API endpoints",
|
|
4
|
-
"version": "0.45.
|
|
4
|
+
"version": "0.45.21",
|
|
5
5
|
"author": "Nomalism <it.nomalism@gmail.com> (https://https://nomalism.com/)",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"prepack": "npm run lint && npm run build"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@nomalism-com/types": "^0.45.
|
|
26
|
+
"@nomalism-com/types": "^0.45.24",
|
|
27
27
|
"axios": "^1.16.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@swc/core": "^1.15.40",
|
|
31
31
|
"@types/node": "^24.12.4",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
33
|
-
"@typescript-eslint/parser": "^8.
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^8.60.0",
|
|
33
|
+
"@typescript-eslint/parser": "^8.60.0",
|
|
34
34
|
"eslint": "^9.39.4",
|
|
35
35
|
"eslint-config-prettier": "^10.1.8",
|
|
36
36
|
"eslint-import-resolver-typescript": "^4.4.4",
|