2024-01-29
3307
#node#react
Avanthika Meenakshi
1936
Jan 29, 2024 â‹… 11 min read

WebSockets tutorial: How to go real-time with Node and React

Avanthika Meenakshi First, solve the problem. Then, write the code.

Recent posts:

Exploring Remix Vite And Other Breaking Changes In Version 2.2.0 And Version 2.7

Exploring Remix Vite support and other v2.20 and v7 changes

The Remix Vite integration helps speeds up development via features like HDR and HMR. Read about Remix Vite and other breaking changes.

Hussain Arif
May 14, 2024 â‹… 7 min read
Caching In Next.js With Unstable_Cache

Caching in Next.js with unstable_cache

In this article, we explore the different caching strategies in Next.js, focusing on the `unstable_cache` function.

Kapeel Kokane
May 14, 2024 â‹… 9 min read
Rescript Vs Typescript Overview And Comparison

ReScript vs. TypeScript: Overview and comparison

Many modern web developers are embracing emerging technologies that improve the speed of development as well as the quality of […]

Clara Ekekenta
May 13, 2024 â‹… 7 min read
Using Pavex For Rust Web Development

Using Pavex for Rust web development

The Pavex Rust web framework is an exciting project that provides high performance, great usability, and speed.

Ukeje Goodness
May 10, 2024 â‹… 6 min read
View all posts

9 Replies to "WebSockets tutorial: How to go real-time with Node and React"

  1. Great, post have you come across any issues in real-world scenario, where a single server has exposed a port on node.js server and multiple clients~80 has seen a deadlock and websocket blockage?

  2. Hi Avanthika , great post.
    Do you know if I can set the header with authentication tokens in the handshake.I mean using W3CW websocer api.
    Apparently the W3CW websocket api only support 2 arguments in the cosntructor.
    there is any way to do that?
    Thanks.

  3. FYI the code block under “Sending and listening to messages on the client side” is the same as the setup block earlier in the article and doesn’t show the example of using client.send.

  4. It’s the same in “Sending and listening to messages on the server side”. The server side was never updated to explain how the editorContent is stored, its scope, nor how to store active users. Very good article otherwise. I like that it isn’t a complete code project and one must dissect it a bit to make it work for any situation. In my case, I integrated this into a new app using react hooks (useState and useEffect).

  5. SSE doesn’t make developers tired. LOL. WebSockets dev is, in fact, far more complicated. The maximum 6 browser connections for SSE also no longer exists with HTTP/2, while WebSockets continue to be blocked by some proxies and load balancers. And most chat apps are actually a perfect use case for SSE because users generally aren’t posting 60 messages per second. There is useful example code on DigitalOcean and Marmelab.com.

  6. “we can’t send data directly from the client (frontend) to the server (backend) without implementing workarounds such as polling”

    Are client and server switched up here? You can send data directly to the server in a post request.

Leave a Reply