ws

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

Ws Alternatives

Similar projects and alternatives to ws

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better ws alternative or higher similarity.

Suggest an alternative to ws

Reviews and mentions

Posts with mentions or reviews of ws. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-09-24.
  • How do web apps integrate webhooks when the user needs frequent updates?
  • GraphQL over WebSockets
    dev.to | 2021-07-29
    With ws
  • Recommendations for WebSocket libraries
    reddit.com/r/reactjs | 2021-07-17
    Highly recommend to not use a library (like socket.io) that requires you to use a specific client/server. I've found that the browser WebSocket class is more than sufficient in most cases and very easy to use. And similarly, a server-side library like ws (if you have a Node.js server) is similarly easy to use. The logic of this is that websockets are very similar to TCP sockets which is the standard for native clients (non-web) and using a lower-level library will make it far easier to switch out technologies, languages, and network protocols if necessary.
  • Understanding someone else code
  • Back with one more question about WebSockets
    reddit.com/r/node | 2021-06-17
    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.
  • Is it possible to receive websocket messages in Node?
    reddit.com/r/node | 2021-06-02
    This client will stay open for as long as the websocket connection to the server is maintained. If the server disconnects it, or if there is a network issue, the script will stop. You could build this into a more complex script that checks for the close, error or unexpected-response events and gracefully tries to reconnect to the server after a specified time. Then you could run this as a persistent script that will keep running indefinitely. See this page for some more documentation: https://github.com/websockets/ws/blob/HEAD/doc/ws.md
  • How to setup my environment for realtime data with WebSockets
    I was planning to use React with WebSockets (https://github.com/websockets/ws) to get realtime data from EXTERNAL source. I tried it first in a plain Node.js project and it went perfectly fine. Then I tried implementing that same code in React, and now I get CORS problems from that server.
  • A simple multi-player online game using node.js - Part IV
    dev.to | 2021-02-26
    As stated above, server.js is responsible for accepting connections and serving static files, I am not using any framework here but I do use the ws module for handling WebSockets connections.
  • Best way to implement node js
    reddit.com/r/node | 2021-02-13
    https://socket.io/get-started/ might be good place to start. It's built on https://github.com/websockets/ws . So searching around for some node.js ws (or socket.io) server tutorials might also be a solid bet.
  • Social assistant - my first full stack project
    dev.to | 2021-02-13
    ws - WebSocket server used to broadcast actual data sync status
  • First attempt at React app
    reddit.com/r/webdev | 2021-01-09
    I'd recommend ditching socket.io and using ws instead. socket.io is an unnecessarily opinionated wrapper for standard websockets that require you to use their client and server and have extreme browser support with fallbacks that you probably don't want anyone to use. Use native websockets and you'll have more control and can use it with any client/server you want and it'll be far faster for your users.

Stats

Basic ws repo stats
11
17,126
8.6
9 days ago

websockets/ws is an open source project licensed under MIT License which is an OSI approved license.

Scout APM: A developer's best friend. Try free for 14-days
Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.
scoutapm.com
Find remote JavaScript jobs at our new job board 99remotejobs.com. There are 16 new remote jobs listed recently.
Are you hiring? Post a new remote job listing for free.