The bleeding edge of Google's Chromium has just had HTML5 WebSockets
added [1] - you currently need a "development release channel" version
to try them out [2].

I've written a simple test to demonstrate how you can have one of
these things talking to a LuaSocket-based application. It's pretty
simple, there's three files:

websocket.lua: http://pastebin.com/f50d79dcd
h5ws_test.lua: http://pastebin.com/f4d2f564c
h5ws_test.html: http://pastebin.com/f9b8a9b6

Put websocket.lua and h5ws_test.lua in the same directory somewhere.
Run h5ws_test.lua (it relies on LuaSocket and Copas being available).
If all goes well it will start listening on port 3018 (and will only
accept connections from 127.0.0.1). Next open h5ws_test.html in the
dev version of Chromium - this is a simple "client" page that is
hardcoded to connect a WebSocket to localhost:3018. Hopefully it will
show a welcome message and allow you to send messages by typing in the
text box and hitting the button. It doesn't do anything very
interesting at the moment - in particular it's not doing anything that
you couldn't easily do with normal AJAX - but the module is more
important than the demo, I hope it is of interest to somebody.

-Duncan

[1] http://blog.chromium.org/2009/12/web-sockets-now-available-in-google.html
[2] http://www.chromium.org/getting-involved/dev-channel

_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to