Skip to content

Event handlers (in custom ui nodes) not receiving widget notifications after socket reconnect #913

Description

@omrid01

Current Behavior

this may be related to #909.
When the Node-red server is restarted (or after deploy/restart flows in the editor), the connection to all dashboard clients is terminated and then automatically restored. However, after the reconnect, the widget can receive new messages from the server node, but some of the widget notifications to the server node's onSocket listener may stop working.
Refreshing the client page solves the issue.

Expected Behavior

After socket connection restoration all widget-node communication (in both directions) should resume properly.

Steps To Reproduce

  1. Take a clean Dashboard 2.0 ui node, for example ui-example
  2. Implement a widget-to-node notification mechanism, e.g.:

In widget:

this.$socket.emit('myCustomEvent'+this.id, this.id, msg)

In server node:

onSocket: {
     ['myCusomEvent'+node.id]: function (conn, id, msg) {console.log("Hello from "+conn)}
  1. Open 3 clients, verify that they all succeed in sending the above notification to the server node
  2. Restart the Node-red server process, or deploy/restart flows in the editor, wait for all clients to reconnect
  3. Try again to send notifications from all clients - usually some of them will fail (nothing arriving on server node)

Environment

  • Dashboard version: 1.10.0
  • Node-RED version: 3.1.9
  • Node.js version: 20.10.0
  • npm version: 10.2.3
  • Platform/OS: Windows
  • Browser: Chrome, Edge

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions