Skip to content
/ msgbus Public

Automatically exported from code.google.com/p/msgbus

License

Notifications You must be signed in to change notification settings

dugsong/msgbus

Folders and files

NameName
Last commit message
Last commit date
Sep 7, 2008
Sep 7, 2008
Sep 7, 2008
Sep 7, 2008
Dec 10, 2006
Sep 7, 2008
Sep 7, 2008
Jan 3, 2007
Sep 7, 2008
Sep 12, 2008

Repository files navigation

msgbus
------

lightweight, evented HTTP/HTTPS publish/subscribe message bus.
implements scalable server push via HTTP multipart/x-mixed-replace for
local or remote messaging, and a minimal (optional) webserver.

http://msgbus.googlecode.com/

what's here:

msgbus
	single-process HTTP/HTTPS message bus / webserver scaling to
	thousands of persistent connections at hundreds of messages
	per second. supports both HTTP/1.0 and HTTP/1.1.

libevmsg
	evented client publish/subscribe API. requires libevent.

python
	Python bindings for libevmsg, plus a demo chat client.

msgsend, msgdump
	trivial Python demo clients

chatdemo
	simple interactive AJAX + COMET webchat demo - e.g. 
	./msgbus -d chatdemo and browse to http://localhost:8888/
	XXX - needs port to Safari...

test-pub, test-sub
	test publisher can flood messages to thousands of parallel
	connections by the test subscriber, or watch the messages at
	http://localhost:8888/msgbus/flood

for a quick test:

1. start msgbus

2. point your browser to http://localhost:8888/msgbus/foo

3. try the following command a few times while watching your browser:

   curl http://localhost:8888/msgbus/foo -H 'Content-Type: text/html' \
        --data-binary "<h1>hello world `date`</h1>"

quick protocol details:

to publish JPEGs as messages on the 'foo' channel:

    POST /msgbus/foo HTTP/1.0
    Content-Type: image/jpeg
    Content-Length: 342
    ...

to subscribe to all messages the 'foo' channel:

    GET /msgbus/foo HTTP/1.0

matching messages are returned in server-push mode, e.g.

    HTTP/1.0 200 OK
    Content-Type: multipart/x-mixed-replace;boundary=XXX

    --XXX
    Content-Type: image/jpeg
    Content-Length: 320
    ...
    --XXX
    Content-Type: text/html
    Content-Length: 53
    ...

or for HTTP/1.1:

    HTTP/1.1 200 OK
    Content-Type: multipart/x-mixed-replace;boundary=XXX
    Transfer-Encoding: chunked

    da
    --XXX
    Content-Type: image/jpeg
    ...
    2b
    -XXX
    Content-Type: application/x-whatever
    ...

to subscribe to only text and image messages on the 'foo' channel:

    GET /msgbus/foo?type=text/*,image/* HTTP/1.1

to subscribe to all messages:

    GET /msgbus/ HTTP/1.0

    HTTP/1.0 200 OK
    Content-Type: multipart/x-mixed-replace;boundary=XXX
    Transfer-Encoding: chunked

    --XXX
    From: dugsong
    Content-Location: /msgbus/foo
    Content-Type: text/plain
    Content-Length: 6
    
    hello
    --XXX
    Content-Location: /msgbus/bar
    Content-Type: application/octet-stream
    Content-Length: 1035
    
    ...

About

Automatically exported from code.google.com/p/msgbus

Resources

License

Stars

Watchers

Forks

Packages

No packages published