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