Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

When to use socket.io?

When to use socket.io?

Problem

I am learning NodeJS and was able to make a Server and an iPhone app that issues an HTTP GET request to the server and retrieve a JSON string from it. I didn't need to use socket.io for this. So why would I need to use it?

Problem courtesy of: neuromancer

Solution

If you are just pulling JSON from the server your Solution works fine. However suppose you want to push data from the server back to the client. Socket.io is a very elegant solution for doing this. Firstly because it handles the push side and secondly because it handles browser degradation gracefully as the 'jQuery of sockets'

Solution courtesy of: deltanovember

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

When to use socket.io?

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×