@yuneta/gobj-js 7.7.1 → 7.7.2

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.
@@ -5592,7 +5592,7 @@
5592
5592
  ***************************************************************/
5593
5593
  function mt_subscription_added(gobj, subs) {
5594
5594
  let priv = gobj.priv;
5595
- if (gobj_current_state(gobj) !== "ST_SESSION") return 0;
5595
+ if (gobj_current_state(gobj) !== "ST_SESSION" || !priv.websocket) return 0;
5596
5596
  if (priv.inside_on_open) return 0;
5597
5597
  return send_remote_subscription(gobj, subs);
5598
5598
  }
@@ -5601,7 +5601,7 @@
5601
5601
  ***************************************************************/
5602
5602
  function mt_subscription_deleted(gobj, subs) {
5603
5603
  let priv = gobj.priv;
5604
- if (gobj_current_state(gobj) !== "ST_SESSION") return 0;
5604
+ if (gobj_current_state(gobj) !== "ST_SESSION" || !priv.websocket) return 0;
5605
5605
  if (priv.inside_on_open) return 0;
5606
5606
  if (empty_string(subs.event)) return 0;
5607
5607
  let kw = {};
@@ -5722,6 +5722,10 @@
5722
5722
  trace_ievent_callback(prefix, iev, 1, size);
5723
5723
  } else trace_inter_event(gobj, prefix, iev);
5724
5724
  }
5725
+ if (!priv.websocket || priv.websocket.readyState !== WebSocket.OPEN) {
5726
+ log_warning(`${gobj_short_name(gobj)}: send_iev(): websocket not open, message lost`);
5727
+ return -1;
5728
+ }
5725
5729
  try {
5726
5730
  priv.websocket.send(msg);
5727
5731
  } catch (e) {