@noya-app/noya-multiplayer-react 0.1.50 → 0.1.51

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.mjs CHANGED
@@ -2209,7 +2209,7 @@ function useMultiplayerState(initialState, options) {
2209
2209
  assetManager: noyaManager.assetManager,
2210
2210
  aiManager: noyaManager.aiManager,
2211
2211
  rpcManager: noyaManager.rpcManager,
2212
- workflowManager: noyaManager.workflowManager,
2212
+ pipelineManager: noyaManager.pipelineManager,
2213
2213
  secretManager: noyaManager.secretManager,
2214
2214
  menuItemsManager: noyaManager.menuManager,
2215
2215
  createAsset: noyaManager.assetManager.create,
@@ -5165,9 +5165,9 @@ function useIsInitialized() {
5165
5165
  );
5166
5166
  return useObservable(isInitializedObservable);
5167
5167
  }
5168
- function useWorkflowManager() {
5168
+ function usePipelineManager() {
5169
5169
  const { noyaManager } = useAnyNoyaStateContext();
5170
- return noyaManager.workflowManager;
5170
+ return noyaManager.pipelineManager;
5171
5171
  }
5172
5172
  var ConnectedUsersContext = createContext(void 0);
5173
5173
  function useConnectedUsersManager() {
@@ -5363,32 +5363,13 @@ var WebSocketConnection = class {
5363
5363
  });
5364
5364
  }
5365
5365
  ws;
5366
- pingCount = 0;
5367
- pendingPingId;
5368
- intervalId;
5366
+ closedForever = false;
5369
5367
  async connect() {
5368
+ if (this.closedForever) return;
5370
5369
  this.ws.connect(this.url.toString());
5371
- this.intervalId = setInterval(() => {
5372
- if (this.ws.state !== "OPEN") return;
5373
- if (this.pendingPingId) {
5374
- this.ws.close();
5375
- return;
5376
- }
5377
- const pingId = (this.pingCount++).toString();
5378
- const message = {
5379
- type: "ping",
5380
- id: pingId
5381
- };
5382
- this.pendingPingId = message.id;
5383
- this.options.onConnectionEvent?.({
5384
- type: "send",
5385
- message
5386
- });
5387
- this.ws.send(JSON.stringify(message));
5388
- }, 1e4);
5389
5370
  }
5390
5371
  handleOpen = () => {
5391
- this.pendingPingId = void 0;
5372
+ if (this.closedForever) return;
5392
5373
  if (this.options.debug) {
5393
5374
  console.info("ws connected");
5394
5375
  }
@@ -5398,6 +5379,7 @@ var WebSocketConnection = class {
5398
5379
  });
5399
5380
  };
5400
5381
  handleMessage = (event) => {
5382
+ if (this.closedForever) return;
5401
5383
  if (this.options.debug) {
5402
5384
  console.info("ws receiving message ", event.data);
5403
5385
  }
@@ -5406,12 +5388,9 @@ var WebSocketConnection = class {
5406
5388
  type: "receive",
5407
5389
  message: parsed
5408
5390
  });
5409
- if (parsed.type === "pong" && parsed.id === this.pendingPingId) {
5410
- this.pendingPingId = void 0;
5411
- }
5412
5391
  };
5413
5392
  handleClose = () => {
5414
- this.pendingPingId = void 0;
5393
+ if (this.closedForever) return;
5415
5394
  if (this.options.debug) {
5416
5395
  console.info("ws disconnected");
5417
5396
  }
@@ -5421,6 +5400,7 @@ var WebSocketConnection = class {
5421
5400
  });
5422
5401
  };
5423
5402
  send(message) {
5403
+ if (this.closedForever) return;
5424
5404
  if (this.options.debug) {
5425
5405
  console.info("ws sending message", message);
5426
5406
  }
@@ -5431,10 +5411,12 @@ var WebSocketConnection = class {
5431
5411
  this.ws.send(JSON.stringify(message));
5432
5412
  }
5433
5413
  close() {
5434
- if (this.intervalId) {
5435
- clearInterval(this.intervalId);
5436
- }
5414
+ if (this.closedForever) return;
5415
+ this.closedForever = true;
5437
5416
  this.ws.shutdown();
5417
+ this.ws.listeners.forEach((listener) => {
5418
+ this.ws.removeListener(listener);
5419
+ });
5438
5420
  }
5439
5421
  addListener(listener) {
5440
5422
  return this.ws.addListener(listener);
@@ -5474,11 +5456,11 @@ export {
5474
5456
  useNoyaState,
5475
5457
  useObservable,
5476
5458
  useOutputTransforms,
5459
+ usePipelineManager,
5477
5460
  useSecret,
5478
5461
  useSecretManager,
5479
5462
  useSecrets,
5480
5463
  useSyncStateManager,
5481
- useViewType,
5482
- useWorkflowManager
5464
+ useViewType
5483
5465
  };
5484
5466
  //# sourceMappingURL=index.mjs.map