S
S
Sergey Prosvirnin2014-03-11 21:37:09
PHP
Sergey Prosvirnin, 2014-03-11 21:37:09

Which technology is better for comet server: tcp sockets, websockets or long polling?

We make a game for contact. We need a two-way server-client connection to transfer data only from the server to the client from the database (on certain events) and back and forth for the chat. I can't figure out which would be better. A highly loaded application is planned (backend on php, frontend on flash). Options to implement on node.js or on php. In websocket, support is somewhat confusing only in new versions of browsers. I guess tcp sockets will outperform websockets? tcp sockets has support for all browsers, and less data is transferred on request/response (as far as I know). There may be other pros or cons.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Prosvirnin, 2014-03-17
@sprosvirnin

We decided to make a comet server on node.js based on tcp-sockets.

T
Tyranron, 2014-03-12
@Tyranron

If the client is on flash, then I don’t see any problems using standard tcp sockets, it’s not js in the browser and no one forbids it.
The server, as for me, is better to do on node.js than on php, since the latter has a different nature initially (although there are all sorts of php-daemons). If there are any heavy calculations on the server, then from node.js you can forward them to the same php so as not to load node.js (it is single-threaded, do not forget about it).
Alternatively, I can also advise using Go. The server on it is written no slower than on node.js, it can work not only in one thread, therefore heavy calculations, in principle, can not be taken out of bounds. Compiling. And also a much richer tool for asynchronous interactions right at the language level, not libraries.

V
VoidVolker, 2014-03-12
@VoidVolker

Web seoctees have long been standardized and are, if not in all, then in popular browsers for sure. And they are much more convenient than any comets and long pollings. A significant advantage of web sockets: there is no extra data when transmitting a message such as http headers, etc., so time and resources are not wasted on their processing. In general, a very convenient thing =)

V
Vladimir Goncharov, 2014-06-18
@morozovsk

At work, they initially used ordinary sockets, tk. there was only an ios application, then a web version appeared and switched to web sockets.
Websocket coverage is about 96% - habrahabr.ru/company/ifree/blog/211504
You can safely use them.
Of the advantages of web sockets over regular sockets (except for browser support) - you can proxy through nginx, which allows you to use one port by several web socket servers, and also with nginx you can limit the number of connections from one ip and other goodies.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question