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