Real-time Communication with Smalltalk Objects

January 7, 2011

Real-time Communications

Real-time Communications


http://www.silversmalltalk.com

Real-time communication of Smalltalk objects between Silver Smalltalk browser sessions is now available.

There is a new class named “Channel” that embodies the functionality.

Commands are:
— Channel open: ‘channelname’
— Channel send: anObject

The channel name can be any string. Clients will receive any objects that are broadcast on a named channel that they have opened.

In the image above, there are two browsers open – Firefox on the left and Opera on the right.

Here is the test sequence:
1) In Firefox workspace (doIt):
Channel open: ‘silver’

2) In Opera workspace (doIt):
Channel open: ‘silver’

At this point, both are communicating over the same channel – the order of messages is unimportant.

3) In Firefox workspace (doIt):
Channel send: ‘Hello SILVER channel!’

4) In Opera workspace (doIt):
| dict |
dict := Dictionary new.
dict at: ‘subject’ put: ‘My Reply’.
dict at: ‘date’ put: ‘Now’.
dict at: ‘message’ put: ‘Hi Ho Silver!’.
Channel send: dict

The default handler for receiving messages opens an inspector on the received object.
To change this:
Vm messageCallback: aBlock

In principle any object can be transmitted.
However, serialization is still immature, so only simple objects can be sent at the present time.

The messaging is handled by Google’s Application ChannelAPI and uses sockets to listen for updates – there is no polling done.

I have tested successfully on Opera, Safari, Chrome, and Firefox. It doesn’t work (surprise!) on IE8.

Also, I have only implemented it so far in the Silverlight browser version of SST.

It will certainly work with the JavaScript version of SST and probably the Flash version. Possibly, I can get it to work with the desktop versions as well once I figure out Google’s socket protocol – they just released this a couple of weeks ago and documentation is limited.

This is scalable, real-time object communications – perfect for games, social networks, and work collaboration applications.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: