Back with one more question about WebSockets

This page summarizes the projects mentioned and recommended in the original post on /r/node

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • ws

    Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js

  • You need to spend a bit more time reading documentation for your library. Take a look at this: https://github.com/websockets/ws#how-to-detect-and-close-broken-connections. In the example they have an interval loop outside of the 'connection' and 'message' loop. You'll need to rearrange your code and declare web socket server object as a variable so you can later refer to it. I have some methods that are run as the application starts (things like db connection, node server confuguration, seeding the db) and that's where you'd keep this sort of things - ideally in a separate method that configures WS server. Talking about documentation and web sockets, I have also found a lot of useful info here: https://rxjs.dev/api/webSocket/webSocket and here: https://rxjs.dev/api/webSocket/WebSocketSubjectConfig. That is assuming that you're using RxJs for handling your WS connection, which is my recommendation after spending a fair mount of time with WS last year.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts