Thanks for your comment. I agree that WebSocket is a suitable choice to create such kind of application, chat. And, the chat was created to provide a simple example of Piping Server in JS for Karan.
One thing I'm not sure is what the side-effect means in this context. Could you give me an example?
What Paulo is saying is right. While your approach will result in a working application, I strongly discourage using long polling (whenever it can be avoided) especially on the client side. It will put a lot of unnecessary load on your server and will prevent it from scaling well. There is a reason why websockets are pretty much a best practice for chat application :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for your comment. I agree that WebSocket is a suitable choice to create such kind of application, chat. And, the chat was created to provide a simple example of Piping Server in JS for Karan.
One thing I'm not sure is what the side-effect means in this context. Could you give me an example?
What Paulo is saying is right. While your approach will result in a working application, I strongly discourage using long polling (whenever it can be avoided) especially on the client side. It will put a lot of unnecessary load on your server and will prevent it from scaling well. There is a reason why websockets are pretty much a best practice for chat application :)