Implement a comet with erlang and use it for a PHP application

I am creating a PHP web application and I have come to the point that I need to create a comet server because I need to update my users whenever new data is available (almost like FB). I spent so much time searching the Internet, and I came to the conclusion that the best way to create a Comet server is to build it with erlang. I also found that apache-php is not a good combination for this, because a process for each request arises. Therefore, I need to create a lightweight HTTP server for a comet application.

I am completely new to the erlang world, but I am thinking about implementing a Comet server in erlang and make it function as a client-only update interface. For the rest of the functions of my web application, I still want to continue implementing them with PHP. Thus, sending requests for client updates to the erlang server and sending other requests to the apache-php server.

It seems very complicated. I need to know what is the best way to learn erlang for the sake of building a Comet server and how to combine the two languages ​​(erlang and php) to work together, as when I got new information. to be clicked on by clients, I need to make new changes available to the comet, and then it pushes the information to users. So how can I capitalize on php and erlang and get them to work together.

Sorry for the long explanation, but I really need your helpers and any advice you can give me to find out and implement what I want. Thank you very much in advance.

EDIT: Should I consider learning Python and Twisted to achieve what I want?

+3
source share
7 answers

This is definitely possible with Erlang. One option is to use a lengthy survey that you can do with mochiweb. http://code.google.com/p/mochiweb/

- . , - , "" TCP- javascript . - JS: http://github.com/gimite/web-socket-js

, Erlang PHP - : http://www.math-hat.com/~zukerman/projects/php-erlang/

, Erlang, , Python Twisted Tornado.

+3

Erlang, , gen_server, gen_event - OTP. Erlang , : http://www.erlang.org/doc/index.html.

PHP Erlang , fsockopen() PHP gen_tcp Erlang. Erlang, PHP ( ).

Erlang PHP, Erlang Python , PHP, , Erlang, PHP .

+2

Apache + php - . , php: Ruby, Python Perl . , , , - - php, , , , . , , .

, node.js, . , javascript.

+2

Python Twisted, Orbited. . Orbited PHP- STOMP.

, Orbited http://thingsilearned.com/2009/06/09/starting-out-with-comet-orbited-part-1/

PHP, Google PHP STOMP

+1

Nginx push- (http://pushmodule.slact.net/)

PHP .

+1

Yaws. - Erlang, , , , PHP-, WebSockets — , .

Yaws github, .

+1

Chicago Boss ... , OTP ( , ), ... .

I am studying this right now after learning OTP.

0
source

Source: https://habr.com/ru/post/1726613/


All Articles