S
S
Shrt2016-11-28 22:41:32
JavaScript
Shrt, 2016-11-28 22:41:32

What is better to use for real time comments, socket.io or Ajax?

Learning node.js, I want to make the following functionality: a topic is created, the user leaves his comment / opinion under the topic, everything should work without reloading the entire page. What is the best way to implement this in a node.js application? Thanks a lot for the replies!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Kitmanov, 2016-11-28
@k12th

And where is real-time in what you described? :) Usual AJAX, sockets are useless here (although you can use them too). If you want to practice with WebSocket, try making a chat. Or add a feature to the comments like on FB: “Someone else is now typing a comment on this post.”

V
Vitaly, 2016-11-28
@vitali1995

All applications on sockets work for us, http issue only statics.
Websockets do not load the network with unnecessary headers and allow you to call the server api as local functions.

R
Rou1997, 2016-11-28
@Rou1997

everything should work without reloading the whole page

What exactly? Should new comments from other users appear like in chats without reloading?
If not, then regular AJAX, if yes, then AJAX with Long polling, either WebSocket or HTML5 SSE.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question