GithubHelp home page GithubHelp logo

kcruci / icomet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ideawu/icomet

0.0 2.0 0.0 2.92 MB

A C1000K comet/push server built with C++, for web and mobile app

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.97% Shell 1.80% CSS 1.30% HTML 4.13% JavaScript 25.36% PHP 0.71% C++ 65.15% C 0.58%

icomet's Introduction

icomet

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.

iComet's role in web system and mobile system

icomet's role

The work process of iComet in your system

The work process of iComet in your system

Compile and Run

Compile:

wget --no-check-certificate https://github.com/ideawu/icomet/archive/master.zip
unzip master.zip
cd icomet-master/
make

Start 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"

JavaScript Library Usage

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);
    }
});

Supported Platforms and Browsers

Browser Platform
Safari iOS(iPhone, iPod, iPad), Mac
Firefox Windows, Mac
Chrome Windows, Mac
IE6, IE8 Windows

Java/Android API

Memory Usage

Connections VIRT RES
0 39m 24m
100,000 302m 288m
200,000 579m 565m
500,000 1441m 1427m
1,000,000 2734m 2720m

2.7KB per connection.

Run the chat demo

  1. Compile and start icomet server
  2. Drag and drop the file demo/web/chat.html into one web browser
  3. Drag and drop the file demo/web/chat.html into another different web browser
  4. Start chatting!

Live demo

This live demo is based on https://github.com/ideawu/icomet-demos, which has buddy list, chat history, and other features.

http://www.ideawu.com/icomet/chat.html

Nginx + icomet

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

Misc

icomet 源码分析

icomet's People

Contributors

0xmalloc avatar ideawu avatar michael2008s avatar yanyiwu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.