Channel Communication Primer

February 16, 2011

Channel Communications

Channel Communications

http://www.silversmalltalk.com/

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.

Channel send:
'This is from Firefox to Opera'

Channel send:
'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.

Advertisements

6 Responses to “Channel Communication Primer”

  1. Jose Says:

    GREAT!

    You can add user (or nick) to communication when create the channel:

    Channel open: ‘test-channel-1’ for: ‘aUser’
    handler: [:x | Transcript println: x]

    And use as prefix of message:

    ‘aUser says: This is from Opera to Firefox’

    • Jose Says:

      JSON communication allows you to identify: sender (user) and message.

      Imagine that you can post private messages to concrete user posting to his channel (channel name = user name)

  2. Steffen Says:

    Great, your project is evolving really quick! I impressed by all the things you have achieved so far.

  3. Steffen Says:

    One question: What happend to the silverlight and Java VM implementations, are they still alive? If yes, where can I find them?


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: