2

I want to apologize about my English. It's not very good.

So, I want to make a chat application (pretty much like Facebook's), and after reading a lot I decided to make this chat app with Erlang. After more reading I found out that I can use Yaws server to make a web application with Erlang, but that's all. I still can't even install and configure it well. So my questions are:

  1. Is this information correct? Do I need Erlang / Yaws to create this chat app?

  2. If it's correct, how do I install and configure it under Windows 7? I've tried to simply install "OTP 17.0 Windows 32-bit Binary File" from here http://www.erlang.org/download.html and "Yaws-1.98-windows-installer.exe" from http://yaws.hyber.org/download/, but I think something went wrong, because after I "configure it" at localhost port 8001/8080 or others still nothing happens. So what's next? Do I have to install my code in special directories and/or what do I have to do next ?

  3. In case I finally get a Chat application in Erlang ready, how can It interface with my PHP code? I mean, I already have the PHP project. It is a normal web project with PHP/HTML/Javascript, etc. so my question is, how do I glue these two elements together?(I would like to stress one more time that I have to make something like the Facebook chat).

I'll be thankful for all kind of information, tutorials, books, videos, anything.

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

1

I agree with you, Erlang is an excellent option for a chat server. If you want to go for Yaws, check the documentation, it support external scripts via CGI and Websockets. All the information you need to communicate your PHP application with your chat Application is on chapter 9 of yaws' pdf documentation.

There are many ways to create a web application in Erlang. Here are some old examples that use mochiweb:

http://pragprog.com/screencasts/v-kserl/source_code

http://www.chrismoos.com/2009/09/28/building-an-erlang-chat-server-with-comet-part-1/

and a nice example from erlang central

Regarding the PHP integration,there are again, several ways to communicate both. You can integrate the chat with your PHP code using a PHP Erlang bridge

or using websockets

or probably you could try to send your data encoded in JSON from mochiweb using mochijson2.erl and communicate both by HTTP using curl from PHP.

All in all, I would probably also use yaws since is well documented and easy to use. Good luck

Community
  • 1
  • 1
oscarftoro
  • 52
  • 1
  • 8
  • For more advanced information on the topic of how erlang is used to build massive chat systems, check out Rick Reed's (from Whatsapp) from Erlang Factory San Francisco 2014: http://www.erlang-factory.com/sfbay2014/rick-reed (slides and video linked from here) – sanmiguel May 27 '14 at 15:55
  • 2
    The answer above neglects to mention that Yaws specifically supports PHP as well, see [the Yaws PDF documentation](http://yaws.hyber.org/yaws.pdf) for more details. It also supports websockets. – Steve Vinoski May 27 '14 at 22:33
  • Thank you for the support, but i still cant install, configure and use Erlang well. I mean, okay Erlang is installed, but I'm still confused about how to install and configure that Yaws. And have one more question. Okay Yaws is Erlang web server, but do i need web framework like Nitrogen or Chicago Boss or other? Or i need just Yaws or just some Framework. And how to make all this stuffs works together. Again, I'm sorry about my stupid/nooby questions. – user3679357 May 29 '14 at 11:11