Tuesday, May 09, 2006

Comet implementation for Seaside web framework

Comet - the next web technology after AJAX allows the server to push updates to all clients (for instance web browsers) when they happen.

Diego Gomez Deck published a first implementation on SqueakMap (called Asteroid). It runs with KomHttpServer (Comanche), JSON and Seaside.

I had to patch the class FastSocketStream with a copy of SocketStream>>sendImmediatelly: to make it work in Squeak 3.8. (3.8 uses a different socket implementation and this method was unfortunately missing).

What it does:
=============
After running "ACometWidgets start" in the Squeak server image you can open more than one web browser on http://localhost:9999

You see some text fields - if you change their values the changes are sent to the server and from there dynamically pushed to the other client web browsers without having to use their "refresh" button.

By evaluating "ACometWidgets instance pushAlertHelloWorld." you get an example how to push data (in this case a java script with an alert) from the server to any connected web browser client. If you leave the Transcript open and close the browsers you will also get a notice that they disconnected.

Update:
I created a short Shockwave demo of Asteroids.

4 comments:

Diego Gomez Deck said...

Torsten,

Thank you very much for sharing the screencast.

Cheers,


-- Diego

Unknown said...

Hi Torsten:

Very good the screencast.

About your comment of patching FastSocketStream, I've tried, used, etc in a 3.8 ·6665 image without problems and without modifiying nothing (because FastSocketStream isn't in my image).

May be is installed by some other package?

Cheers.

Carl Gundel said...

Thanks for this enhancement. Is there a version of this for Seaside on VisualWorks?

Diego Gomez Deck said...

Hi Carl,

The Comet implementation I made doesn't need Seaside at all. It just depends on Comanche (the Squeak Web Server).

I didn't take the time to investigate the VW web-server.

Cheers,

-- Diego