Dynamic Web Development with Seaside

Buy PDF Buy Print

22.2Getting Started

The Seaside Comet functionality comes packaged in the package named Comet. Most prebuilt images come with this package preloaded. Point your browser to http://localhost:8080/comet/counter, which is a simple Comet based counter application.

Comet requires a server adapter that supports streaming of the response.

Most likely the first time you try to use a Comet application you will end up with an error message as seen above. What does Streaming-server required mean? On most Smalltalk platforms Seaside does not stream responses by default. This means that the response is sent to the client only after the complete body is generated. Obviously this does not work for Comet, since we need to continually send data to the client.

The default server adapter on Squeak does not support streaming and neither does Swazoo. Instead, you need to use a special wrapper around Comanche, called WAListenerAdaptor. Evaluate WAListenerAdaptor startOn: 8888 to start the server. Note that we are using a different port number here, to avoid a conflict with the normal server that continues to work on port 8080.

If you try to access your application again (with the new port number), you will be able to see the counter application. Open multiple browser windows, preferably with different browsers and using different machines. As you can see below, clicking on the links in one application propagates immediately to the other windows. Note that every window has its own Seaside session, it is just the global count variable that is synced with all the currently connected sessions.

The counter application synchronized along different web browsers.

Let’s have a look at the implementation and study the differences from our first counter implementation at the beginning of this book.

Copyright © 26 September 2017 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.