This is more of a proof-of-concept, or experiment than anything. Chats are pushed to the server along with latitude and longitude obtained using HTML5 Geolocation. The chats are then pushed out to all connected clients via EventMachine::Channel. The client listens for new chats, which arrive as server-sent events, and displays an info window on the map at the specified coordinates, along with the chat message.
To run it locally, just cd
to the app directory and type ruby server.rb -sv
. Then, point your browser to 0.0.0.0:9000
. You'll probably want to use two computers to experiment, or your mobile device.
To see it in production, head to sse-goliath.herokuapp.com
Copyright © 2012 Peter Brindisi