Tuesday, July 01, 2008

Bad @ss, TCP/IP from a Web Browser in JavaScript

Welcome to the world of "Comet" servers. What is a Comet server? A Comet server is a server that supports communicating via TCP and other protocols directly to and from a web server from a web browser using client side Javascript. Typically you could enable doing this by using a Java applet or a Flash object, but javascript I guess has matured enough to the point where this can be done, in theory, without the use of external plugins.

Read on [HERE] for more info about Comet servers.

Below is a great comet server called Orbital that is open source, plays well with both IIS and Apache, and is easy to use. Read about it here-

http://cometdaily.com/2008/07/01/sockets-in-the-browser/

Here is just a taste of how easy it is to use (allegedly, I haven't installed it yet)-

var conn = new TCPSocket(hostname, port)
conn.onopen = function() { alert('connection opened!') }
conn.onread = function(data) { alert('RECEIVE: ' + data) }
conn.onclose = function(data) { alert('connection closed!') }
conn.send('Hello World');

Wow. Chat. MMO's. Ditching bloated complex web services as a means of communication. If Orbital works as advertised, I see whole new worlds opening up.

Orbital's website is here-

http://orbited.org/

I found this post on Ajaxian, an excellent blog well worth an RSS subscription-

http://ajaxian.com/archives/tcpsocket-sockets-in-the-browser

No comments: