My favorites | Sign in
Project Logo
             
Search
for
Updated Dec 07, 2007 by rsaccon
Labels: Featured
Tutorial  
First steps

Introduction

This document contains notes on building, configuring, running and testing the server.

Target audience: developers with at least basic understanding Comet.

Requirements: Erlang has to be installed on your system (get the sources from: http://www.erlang.org/download.html or pre-compiled: http://cean.process-one.net/download/)

Important notice for windows users: install cygwin first or rewrite the Makefile for windows (and post it here please)

Getting the code

Get the code from svn:

svn co http://erlycomet.googlecode.com/svn/trunk erlycomet-read-only

Compiling and configuring the server

cd erlycomet-read-only
make 

Running the server

make run

This will start the server on Port 3000 and open the interactive Erlang shell. If you want to use a different port, then you have to edit the file erlycomet.app in the ebin directory. You'll also need to edit the erlycomet/demo-docroot/index.html. For ports < 1024 your Erlang distribution needs to have fd_server package installed.

If you want to experiment with cross domain Comet, you can easily start a second server on Port 3001 (from another terminal):

make runx

In a real world application you probably are going to run the cluster nodes on different hosts.

Demos

Check the server status on the interactive Erlang shell:

(erlycomet_demo@Macintosh)1> erlycomet_demo:status().
Total connected clients: 0

ok
(erlycomet_demo@Macintosh)2>

Start first client: http://localhost:3000

Check the server status again, you should see now one connection:

(erlycomet_demo@Macintosh)2> erlycomet_demo:status().
Total cnnmected clients: 1

ok
(erlycomet_demo@Macintosh)3> 

now start the epoch-mod-1000 counter (which runs at server side and pushes its value to all connected clients) and check again the status:

(erlycomet_demo@Macintosh)3> erlycomet_demo:status().
Total connected clients: 2

Channel: "/test/time"  Connected clients: 1
ok
(erlycomet_demo@Macintosh)4> 

If you leave the browser window open, the server will disconnect after a timeout of 20 minutes (currently hard-coded).

Start second client: http://localhost:3001

the second client accesses cross-domain (via callback-polling) the first server. Now check on both servers the status again and you should see on both the two connections.

erlycomet_demo:status().
(erlycomet_demo@Macintosh)4> erlycomet_demo:status().
Total connected clients: 2

Channel: "/test/time"  Connected clients: 1
ok
(erlycomet_demo@Macintosh)5> 

Now have fun with the chat demo !


Comment by blueflycn, May 12, 2009

Great work~ Thanks for your effort~

Comment by my8Bird, Nov 04, 2009

I read the comment at the top about building on windows and if you have make installed, I used gnuwin32 to build the project and everything is working great. I was actually hoping for a quick challenge tonight but thought this workaround might be good to share. I am running Win7 RC but that this should work with XP and Vista also.

http://gnuwin32.sourceforge.net/


Sign in to add a comment
Hosted by Google Code