RomaValcer
RomaValcer

Reputation: 2956

Which type of communicating with server is better for chat?

I want to make a simple chat web app (so it will be b2g compatible), and I want to know which implementation of client-server talk is better: REST API, or some kind of web sockets?

Upvotes: 0

Views: 63

Answers (1)

Kinjo
Kinjo

Reputation: 1456

Websockets has lower latency because you can push to clients and less overhead because you do not need to poll like with REST. REST has better support for old browsers (which does not support websockets).

So it really depends on your requirements. It is mostly a browser support vs latency dilemma.

Browser support for web sockets:

http://en.wikipedia.org/wiki/WebSocket#Browser_support

Edit (added):

All kinds of mechanisms which can be used for a chat app: What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?

Upvotes: 1

Related Questions