Sha256: bba61c3c1cd97fabc1e3d603587eaa781be1035f02915a05267c0d224d1888ca
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
Puggernaut ========== Simple server push implementation using eventmachine and long polling. ![Puggernaut](/winton/puggernaut/raw/master/puggernaut.png) Requirements ------------ <pre> gem install puggernaut </pre> How it works ------------ Puggernaut consists of three pieces: * TCP client to send push messages * TCP server to receive push messages * HTTP server to deliver long poll requests Start it up ----------- Run the <code>puggernaut</code> binary with optional port numbers: <pre> puggernaut <http port> <tcp port> </pre> The default HTTP and TCP ports are 8000 and 8001, respectively. Set up proxy pass ----------------- You will need to set up a URL on your public facing web server that points to the Puggernaut HTTP server. If you do not see your web server below, [Google](http://google.com) is your friend. ### Apache *http.conf* <pre> ProxyPass /long_poll http://localhost:8000/ ProxyPassReverse /long_poll http://localhost:8000/ </pre> ### Nginx *nginx.conf* <pre> location /long_poll { proxy_pass http://localhost:8000/; } </pre> Send push messages ------------------ <pre> require 'puggernaut' client = Puggernaut::Client.new("localhost:8001", "localhost:9001") client.push :channel => "message" client.push :channel => [ "message 1", "message 2" ], :channel_2 => "message" </pre> The <code>Client.new</code> initializer accepts any number of TCP server addresses. Receive push messages --------------------- Include [puggernaut.js](/winton/puggernaut/public/puggernaut.js) into to your HTML page. Javascript client example: <pre> Puggernaut.path = '/long_poll'; Puggernaut .watch('channel', function(e, message) { // do something with message }) .watch('channel_2', function(e, message) { // do something with message }); Puggernaut.unwatch('channel'); </pre>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
puggernaut-0.1.0 | README.md |