should i use socket io to handle my app events ?
Unanswered
Giant panda posted this in #help-forum
Giant pandaOP
I am building a chat app kinda of a discord clone using socket io i am thinking a lot about creating global listener using socket io for things like notifications , friend requests , users connection status or anything that should be handled in real time i have noticed in discord that when any of these events happen they happen in real time and quite fast actually for example if a friend connects to the app you immediately see the friend connection status change from offline to online , when a user sends a friend request you immediately recieve a notification same if you accept the friend request your friends list updates at once or should i opt for a request - response model for example if a friend request is sent to a user i should send a request to my backend to handle that then get a response and update the new state of the app ?
3 Replies
Eulophid wasp
For anything realtime you'll want to use websockets
They're faster with lower overhead. You can build this service yourself, or there are some pre-built ones out there
HTTP is great for request/response, whereas websockets can be used for broadcasts, messages, etc. With socket-io you essentially subscribe to different "channels" without having to constantly request their state.