Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Add support for WebSockets as an alternative to Server-Sent Events #5443

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

netroy
Copy link
Member

@netroy netroy commented Feb 9, 2023

N8N-4856

Possibly addresses #4162, #959, and #36.
Supercedes #5082.

@netroy netroy added the skip-e2e label Feb 9, 2023
@netroy netroy force-pushed the N8N-4856-websocket-push branch from dc428df to 67b0511 Compare February 9, 2023 19:59
@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Feb 9, 2023
@netroy netroy force-pushed the N8N-4856-websocket-push branch 2 times, most recently from bdcaa11 to ce47d66 Compare February 9, 2023 23:38
…nt Events

Co-authored-by: Matthijs Knigge <matthijs@volcano.nl>
@netroy netroy force-pushed the N8N-4856-websocket-push branch from ce47d66 to fbd7877 Compare February 9, 2023 23:40
Copy link
Contributor

@krynble krynble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested both modes with multiple users, all working fine.

We must let @StarfallProjects know to add this to the docs.

@netroy netroy merged commit 538984d into master Feb 10, 2023
@netroy netroy deleted the N8N-4856-websocket-push branch February 10, 2023 14:02
@n8n-assistant n8n-assistant bot added the Upcoming Release Will be part of the upcoming release label Feb 10, 2023
MiloradFilipovic added a commit that referenced this pull request Feb 10, 2023
* master:
  🔖 Release n8n@0.215.0
  ⬆️ Set n8n-core@0.154.0, n8n-editor-ui@0.181.0, n8n-nodes-base@0.213.0 and n8n-workflow@0.136.0 on n8n
  🔖 Release n8n-editor-ui@0.181.0
  ⬆️ Set n8n-design-system@0.53.0 and n8n-workflow@0.136.0 on n8n-editor-ui
  🔖 Release n8n-design-system@0.53.0
  🔖 Release n8n-nodes-base@0.213.0
  ⬆️ Set n8n-core@0.154.0 and n8n-workflow@0.136.0 on n8n-nodes-base
  🔖 Release n8n-node-dev@0.93.0
  ⬆️ Set n8n-core@0.154.0 and n8n-workflow@0.136.0 on n8n-node-dev
  🔖 Release n8n-core@0.154.0
  ⬆️ Set n8n-workflow@0.136.0 on n8n-core
  🔖 Release n8n-workflow@0.136.0
  fix(core): Stop using unbound calls to `stopProcess` (no-changelog) (#5456)
  test(Read PDF Node): Unit tests (no-changelog) (#5453)
  test(Move Binary Data Node): Unit tests (no-changelog) (#5442)
  test: Add tests for ActiveWorkflowRunner class (#5278)
  feat(core): Add support for WebSockets as an alternative to Server-Sent Events (#5443)
  refactor(core): Delete duplicate code across all  commands (#5452)
@janober
Copy link
Member

janober commented Feb 10, 2023

Got released with n8n@0.215.0

@janober janober removed the Upcoming Release Will be part of the upcoming release label Feb 10, 2023
@joshxyzhimself
Copy link

how to use this?

I'm on 0.217.1

image

@netroy
Copy link
Member Author

netroy commented Feb 27, 2023

@joshxyzhimself This PR added support for websockets as a push mechanism for internal api calls in n8n.
This does not add a WebSocket node. There is a proof-of-concept PR, but we currently do not have an ETA on that.

@joshxyzhimself
Copy link

Got it.

I somehow wish uws (https://github.com/uNetworking/uWebSockets.js) gets used over ws though, which has built-in pub-sub feature.

Possible triggers:

  • websocket on connect
  • websocket on message
  • websocket on disconnect

Possible actions:

  • websocket unicast message
  • websocket multicast message
  • websocket broadcast message
  • websocket subscribe
  • websocket unsubscribe
  • websocket close connection

@netroy
Copy link
Member Author

netroy commented Feb 27, 2023

@joshxyzhimself We originally wanted to use uWebSockets.js, but it's not available on NPM, and we don't want to deal with the hassle of switching registries or pulling packages from multiple places right now.
We also had some issues with using uws on alpine linux (in our docker image), and I think adding libc didn't help either (but, I'm not certain about that).

ws satisfies all our current requirements.
Perhaps in the future if our requirements change, we'll reconsider this decision then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team skip-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants