[Pharo-project] Aida with Realtime (WebSockets) support released
Dear Smalltalkers, 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 browsers: http://demo.aidaweb.si/demos?view=realtime And how easy is using real-time in your code? See the simplified code of above demo: WebDemoApp>>viewRealtime | e counterElement | self enableRealtime. counterElement := e add: self counterElement. (e addButtonText: ' Decrement ') noSubmit; onClickDo: [self observee decCounter]. (e addButtonText: ' Increment ') noSubmit; onClickDo: [self observee incCounter]. self observee onChangeDo: [counterElement update] on: counterElement app: self. self add: e. WebDemoApp>>counterElement | e | e := WebElement newSpan. e style: 'font-size: 40px'. e addText: self observee counter printString. ^e 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 is changed. New Aida 6.5 Interim release is released for Squeak, Pharo and VisualWorks and available from usual places. See http://www.aidaweb.si for more. Everyone is welcome to try it and come with suggestions how to use this new feature, how to improve it, .... Further read: http://www.aidaweb.si/websocket%20support http://www.swazoo.org/websocket Best regards Janko -- Janko Mivšek Aida/Web Smalltalk Web Application Server http://www.aidaweb.si
Thanks Janko. The demo site doesn't seem to work, the buttons are disabled, but I believe you it works! :) What's the relation between AIDA/Swazoo Websockets and Sven's implementation? Regards! -- View this message in context: http://forum.world.st/Aida-with-Realtime-WebSockets-support-released-tp46535... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Yes, does it use http://forum.world.st/ANN-Zinc-WebSockets-tp4647191.html ? -- View this message in context: http://forum.world.st/Aida-with-Realtime-WebSockets-support-released-tp46535... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Hola Esteban, Dne 02. 11. 2012 13:50, piše Esteban A. Maringolo:
Thanks Janko.
The demo site doesn't seem to work, the buttons are disabled, but I believe you it works! :)
Which browser and which version do you use? Do you have in red a warning that your browser is not supported? I need to catch that problem which seems to happen on not-recent WebSocket enabled browsers, so your info will be very valuable.
What's the relation between AIDA/Swazoo Websockets and Sven's implementation?
To my knowledge not related except that both should implement the same RFC version of the standard. And Zinc HTTP client should work with Swazoo server over WebSockets. Also, Swazoo has a WebSocket implementation for two years already, recently was just upgraded to the last RFC version. Best regards Janko -- Janko Mivšek Aida/Web Smalltalk Web Application Server http://www.aidaweb.si
Janko Mivšek wrote
Hola Esteban,
Dne 02. 11. 2012 13:50, piše Esteban A. Maringolo:
Thanks Janko.
The demo site doesn't seem to work, the buttons are disabled, but I believe you it works! :)
Which browser and which version do you use? Do you have in red a warning that your browser is not supported?
I need to catch that problem which seems to happen on not-recent WebSocket enabled browsers, so your info will be very valuable.
Google Chrome Version 22.0.1229.94 m, Windows 7 Professional Looking at the developer console, there is a websocket created, but with status 101 (pending) This is the HAR for the connection: { "startedDateTime": "2012-11-02T17:50:17.319Z", "time": -1, "request": { "method": "GET", "url": "ws://demo.aidaweb.si/aidasession/websocket?pageurl=/demos?view=realtime", "httpVersion": "HTTP/1.1", "headers": [ { "name": "Origin", "value": "http://demo.aidaweb.si" }, { "name": "Connection", "value": "Upgrade" }, { "name": "Sec-WebSocket-Extensions", "value": "x-webkit-deflate-frame" }, { "name": "Host", "value": "demo.aidaweb.si" }, { "name": "Sec-WebSocket-Key", "value": "fDT6RMiJRCTBSMOQlAAzfw==" }, { "name": "Upgrade", "value": "websocket" }, { "name": "Sec-WebSocket-Version", "value": "13" } ], "queryString": [ { "name": "pageurl", "value": "/demos" } ], "cookies": [], "headersSize": 86, "bodySize": 0 }, "response": { "status": 101, "statusText": "WebSocket Protocol Handshake", "httpVersion": "HTTP/1.1", "headers": [ { "name": "Date", "value": "Fri, 02 Nov 2012 18:50:19 GMT" }, { "name": "Connection", "value": "Upgrade" }, { "name": "Content-Length", "value": "0" }, { "name": "Server", "value": "Swazoo 2.3 Smalltalk Web Server" }, { "name": "Upgrade", "value": "websocket" }, { "name": "Sec-WebSocket-Accept", "value": "JQglwpGvhMsAoUM2dc1d1GG3Dt0=" } ], "cookies": [], "content": { "size": 0, "compression": 0 }, "redirectURL": "", "headersSize": 13, "bodySize": 0 }, "cache": {}, "timings": { "blocked": 0, "dns": -1, "connect": -1, "send": -1, "wait": -1, "receive": -1, "ssl": -1 }, "pageref": "page_1" } Regards! -- View this message in context: http://forum.world.st/Aida-with-Realtime-WebSockets-support-released-tp46535... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Dne 02. 11. 2012 18:52, piše Esteban A. Maringolo:
The demo site doesn't seem to work, the buttons are disabled, but I believe you it works! :)
Which browser and which version do you use? Do you have in red a warning that your browser is not supported?
I need to catch that problem which seems to happen on not-recent WebSocket enabled browsers, so your info will be very valuable.
Google Chrome Version 22.0.1229.94 m, Windows 7 Professional
Looking at the developer console, there is a websocket created, but with status 101 (pending)
Esteban, can reload the page (to refresh JS) and try again? I namely improved detection of WebSocket if it is really open. You can also open Chrome devtools to see if button press sends WebSockets message or plain Ajax one. Reload a page, click WebSocket in footer of devtools (tab Network), then on the left click the only choice websocket /aidasession and you'll see all WS messages sent so far. Best regards Janko
This is the HAR for the connection:
{ "startedDateTime": "2012-11-02T17:50:17.319Z", "time": -1, "request": { "method": "GET", "url": "ws://demo.aidaweb.si/aidasession/websocket?pageurl=/demos?view=realtime", "httpVersion": "HTTP/1.1", "headers": [ { "name": "Origin", "value": "http://demo.aidaweb.si" }, { "name": "Connection", "value": "Upgrade" }, { "name": "Sec-WebSocket-Extensions", "value": "x-webkit-deflate-frame" }, { "name": "Host", "value": "demo.aidaweb.si" }, { "name": "Sec-WebSocket-Key", "value": "fDT6RMiJRCTBSMOQlAAzfw==" }, { "name": "Upgrade", "value": "websocket" }, { "name": "Sec-WebSocket-Version", "value": "13" } ], "queryString": [ { "name": "pageurl", "value": "/demos" } ], "cookies": [], "headersSize": 86, "bodySize": 0 }, "response": { "status": 101, "statusText": "WebSocket Protocol Handshake", "httpVersion": "HTTP/1.1", "headers": [ { "name": "Date", "value": "Fri, 02 Nov 2012 18:50:19 GMT" }, { "name": "Connection", "value": "Upgrade" }, { "name": "Content-Length", "value": "0" }, { "name": "Server", "value": "Swazoo 2.3 Smalltalk Web Server" }, { "name": "Upgrade", "value": "websocket" }, { "name": "Sec-WebSocket-Accept", "value": "JQglwpGvhMsAoUM2dc1d1GG3Dt0=" } ], "cookies": [], "content": { "size": 0, "compression": 0 }, "redirectURL": "", "headersSize": 13, "bodySize": 0 }, "cache": {}, "timings": { "blocked": 0, "dns": -1, "connect": -1, "send": -1, "wait": -1, "receive": -1, "ssl": -1 }, "pageref": "page_1" }
Regards!
-- View this message in context: http://forum.world.st/Aida-with-Realtime-WebSockets-support-released-tp46535... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
-- Janko Mivšek Aida/Web Smalltalk Web Application Server http://www.aidaweb.si
participants (3)
-
Esteban A. Maringolo -
Geert Claes -
Janko Mivšek