A C1000K comet/push server built with libevent.
iComet is powerfull, can be used as the messaging server of many applications, such as web chat, mobile application, desktop application etc.
iComet provides a easy-to-use JavaScript library, with iComet js lib, you can build a web app that needs server-push feature very fast.
Compile:
wget --no-check-certificate https://github.com/ideawu/icomet/archive/master.zip
unzip master.zip
cd icomet-master/
makeStart icomet server
./icomet-server icomet.conf
# or run as daemon
./icomet-server -d icomet.conf
# stop
./icomet-server icomet.conf -s stop
Make a test via curl:
curl -v "http://127.0.0.1:8100/sub?cname=12&seq=1"
# open another terminal
curl -v "http://127.0.0.1:8000/push?cname=12&content=hi"
var comet = new iComet({
channel: 'abc',
signUrl: 'http://127.0.0.1:8000/sign',
subUrl: 'http://127.0.0.1:8100/sub',
callback: function(content){
// on server push
alert(content);
}
});| Browser | Platform |
|---|---|
| Safari | iOS(iPhone, iPod, iPad), Mac |
| Firefox | Windows, Mac |
| Chrome | Windows, Mac |
| IE6, IE8 | Windows |
- https://github.com/DuoZhang/iCometClient4j
- Android App Demo
- Compile and start icomet server
- Drag and drop the file demo/web/chat.html into one web browser
- Drag and drop the file demo/web/chat.html into another different web browser
- Start chatting!
This live demo is based on https://github.com/ideawu/icomet-demos, which has buddy list, chat history, and other features.
You can integrate icomet with nginx. If you are running you website on port 80 with domain www.test.com. That is you visit your website home page with this url:
http://www.test.com/
Then you want to run icomet on the same server with port 80, for the concern of firewall issue. You can config nginx to pass request to icomet:
location ~ ^/icomet/.* {
rewrite ^/icomet/(.*) /$1 break;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_buffering off;
proxy_pass http://127.0.0.1:8100;
}
Then, this url is used to subscribe to icomet channel xxx:
http://www.test.com/icomet/sub?cname=xxx
- xiaozhu.com
- testin.cn
- 389083972

