html5 websockets and ruby

Update 6/2014 – Working examples at Internet sensors projects: https://reactivemusic.net/?p=5859

original post

notes

http://www.html5rocks.com/en/tutorials/websockets/basics/

http://www.websocket.org/echo.html

http://html5demos.com/web-socket

Got some examples running in web sockets (finally). Like with node.js, you can’t access servers from outside, which specify their ip address as localhost – you need to actually set a real ip, even if its a private ip like 192.168.1.20

Anyway I was able to get a ruby websocket server running using em-websocket and also another version using eventmachine.

Local files are in tkzic/websockets

the examples are running a public server at http://zerokidz.com/websockets/index.html

(need to start the server – also in that directory: ./server.rb

There’s also a simple node.js webserver in that folder – but after solving the problem above – apache works just fine.

How do I talk to a client from within a loop using EventMachine?