Channel Communication Primer
February 16, 2011
Above is an image of the first channel communication tests for QuickSilver. By “channel communication” I am referring to a scalable instant-message system using Google’s ChannelAPI.
There is a new Smalltalk class named “Channel” which handles the communications. The only methods that you need to use are:
Channel open: aName handler: aBlock
Channel send: aString
In the example shown, instant messages are being sent between a Firefox browser and an Opera browser; it would also work the same way for hundreds of users scattered around the world.
In each browser, we need to open a “channel” with the same name for both browsers:
Channel open: 'test-channel-1'
handler: [:x | Transcript println: x]
Then, we can simply send messages over the opened channel and they will immediately be available to all subscribers to the channel.
'This is from Firefox to Opera'
'This is from Opera to Firefox'
Sending text (strings) this way is not the most useful way to communicate.
Tomorrow, I will add the serialization capabilities (using JSON) so that we can send *objects* between QuickSilver sessions.
After that, we can start building some very interesting communication and collaboration tools.