http - At what frequency of updates do WebSockets become more efficient than longpolling? -
i'm working on project, , i'm trying decide whether use websockets or longpolling.
this brings interesting question: breakeven point between using websockets instead of traditional http techniques? clearly, if need daily updates, http requests better, real-time updates, websockets better. (i think. correct me if i'm wrong!)
let me more specific:
assume user experience web app requires user updated in period of time p.
additionally, assume using websockets send updates server client, , average json object sent looks ( i'm including because 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 man's best friend!" }
in experience, @ around (no need extremely precise) period p make more sense use websockets instead of traditional http techniques scaling , cost purposes?
the right decision depends on lot of factors, not refresh intervals.
hard downsides of long polling?
websocket/rest: client connections?
on experience, not use long polling unless there big reason or data push feature of application dull.