I'm working on a project, and I'm trying to decide whether to use WebSockets or longpolling.
This brings up an interesting question: what is the breakeven point between using WebSockets instead of traditional HTTP techniques? Clearly, if you need daily updates, http requests are better, but for real-time updates, WebSockets would be better. (I think. Correct me if I'm wrong!)
Let me be more specific:
Assume that for a good user experience a web app requires a user to be updated in a period of time P.
Additionally, assume that we are only using WebSockets to send updates from the server to the client, and that the average JSON object sent looks like this ( I'm including this because I imagine average data size matters):
{ 'animal' : 'dog',
'people_who_have_petted' : ['Foo', 'Bar', 'Thomas'],
'people_who_like' : ['Tom', 'Foo', 'Bar', 'Thomas','John', 'Mary'],
'people_who_dislike' : ['Jerry','Cat', 'Banker']
'user_voted_phrase' : "Dogs are a man's best friend!"
}
In your experience, at around (no need to be extremely precise) what period P would it make more sense to use WebSockets instead of traditional http techniques for scaling and cost purposes?