@nevuamarkets/poly-websockets 0.1.4 → 0.1.5

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.
@@ -143,7 +143,7 @@ class GroupSocket {
143
143
  var _a;
144
144
  group.status = WebSocketSubscriptions_1.WebSocketStatus.DEAD;
145
145
  clearInterval(this.pingInterval);
146
- await ((_a = handlers.onWSClose) === null || _a === void 0 ? void 0 : _a.call(handlers, group.groupId, code, reason.toString()));
146
+ await ((_a = handlers.onWSClose) === null || _a === void 0 ? void 0 : _a.call(handlers, group.groupId, code, (reason === null || reason === void 0 ? void 0 : reason.toString()) || ''));
147
147
  };
148
148
  if (group.wsClient) {
149
149
  // Remove any existing handlers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nevuamarkets/poly-websockets",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Plug-and-play Polymarket WebSocket price alerts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -161,10 +161,10 @@ export class GroupSocket {
161
161
  handlers.onError?.(new Error(`WebSocket error for group ${group.groupId}: ${err.message}`));
162
162
  };
163
163
 
164
- const handleClose = async (code: number, reason: Buffer) => {
164
+ const handleClose = async (code: number, reason?: Buffer) => {
165
165
  group.status = WebSocketStatus.DEAD;
166
166
  clearInterval(this.pingInterval);
167
- await handlers.onWSClose?.(group.groupId, code, reason.toString());
167
+ await handlers.onWSClose?.(group.groupId, code, reason?.toString() || '');
168
168
  };
169
169
 
170
170
  if (group.wsClient) {