Home

jounikoivuviita edited this page Dec 17, 2011 · 7 revisions
Clone this wiki locally

Note: purely experimental at this point, not recommended for anything serious

Seep.js is a web application framework built on top of connect and socket.io. Connect is used for the basic HTTP server socket.io for the primary communication between the client and the actual web application running in the server.

The application state lives in the server memory. This means you won't lose your work in the application even between page refreshes. It also means that some amount of memory is constantly reserved on the server when the application is running.

A Seep application consists of your usual UI suspects: windows, layouts, buttons, text inputs, plain texts, checkboxes, selects, tabs etc. You construct your application using these widgets, and hook them to your business logic and possible data sources.

So nothing new under the sun, or particularly exciting.

But there's feature which is not so common. Seeping application logic.

App logic seeping

The name of the framework comes from this feature. You can specify explicitly which parts of the application logic should be run on the client, instead of all logic being run on the server. You can make the application respond instantly to the user, while you simultaneously get the benefits of server side application logic (no need for custom RPC, data synchronization etc.).

The framework handles the state synching and data transfer automatically for you, using JSON, only transferring the state changes, not the complete UI state.

The way to 'seep' logic, is to specify the 'client' property for an event listener:

var button = new seep.Button("Click Me")
button.addListener("click", function(e) {
    alert("Hi! I'm run in the client")
}, {client: true})

This will serialize the callback function and pass it to the client, and run it when the approriate event is triggered in the client.

If we leave the 'client' property out, the same event callback will be run on the server: the click event on the client will trigger a socket message to the server with the event details, and the callback is run. Only, in this case the callback will produce an error, since there's no 'alert' function specified in the server.