[aida] Aida with Realtime (WebSockets) support released
janko.mivsek at eranova.si
Thu Nov 1 20:34:43 CET 2012
I think it can be safely claimed that Aida/Web is a first Smalltalk web
framework, even more, one of the first frameworks at all to integrate
HTML5 WebSockets for so called realtime web apps. Realtime in sense that
values on the page are updated immediately when value changes on the
server, without needing to manually reload a page.
You can see that in action from WebSocket-capable browsers (latest
Firefox and Chrome) if you open in two browsers the online Aida realtime
counter demo, click buttons on one and observe changes instantly in both
And how easy is using real-time in your code? See the simplified code of
| e counterElement |
counterElement := e add: self counterElement.
(e addButtonText: ' Decrement ')
onClickDo: [self observee decCounter].
(e addButtonText: ' Increment ')
onClickDo: [self observee incCounter].
onChangeDo: [counterElement update]
on: counterElement app: self.
self add: e.
| e |
e := WebElement newSpan.
e style: 'font-size: 40px'.
e addText: self observee counter printString.
To describe this code a bit: you first enable realtime for this view of
demo App. Element on the webpage to update in realtime must be created
in a separate method (#counterElement). After buttons for increment and
decrement we come to the main part - registering the block to execute on
every change of domain object. Calling simply #update to the counter
element is enough to be updated on all browsers which currently observe
that counter demo.
How this works? Behind the scenes a so called realtime channel is open
between browser and Aida server. This WebSocket based channel is
bidirectional and full-duplex, meaning that Aida can send back to the
browser a message at any time. In above case a command to update the
counter element is sent back to all browsers immediately after counter
New Aida 6.5 Interim release is released for Squeak, Pharo and
VisualWorks and available from usual places. See http://www.aidaweb.si
Everyone is welcome to try it and come with suggestions how to use this
new feature, how to improve it, ....
Smalltalk Web Application Server
More information about the Aida