To run the above demo, open a Lisp workspace and execute “(@open HttpDemo)” – you can open Vista Smalltalk in your browser here.
There is now a new class, HttpConnection, for connecting to Http servers. Using it is simple:
- create a new HttpConnection instance with the target URL
- add a callback function to the connection
- then send requests as needed – arguments are optional
As an example of usage, here is the complete “open” function for HttpDemo.
(add-method (class-of HttpDemo) 'open
(lambda()
(let ((cn nil) (ta (@new TextArea)) (w nil))
(setq cn (@new- HttpConnection
"http://vistascript.net/vistascript/flex/htmltest1.txt"))
(@callback- cn (lambda(html) (@htmltext- ta html)))
(setq w (@open- SizeableTitleWindow "Http Demo"))
(@addchild- w ta)
(@send cn)
w)))
Once I have added JSON serialization to this class, I will prepare an”Ajax-style” demo similar to those in Vista Smalltalk for WPF.
Unfortunately, I have not yet been able to get XMPP (Jabber) communications to work yet – Jabber IM is one possible basis for browser-to-browser games using some of the new graphic elements that are now available.
