Updated 2013-06-30 17:36:26 by apw

  • The Message Interface

For the message interface a simple string based protocol was implemented, which had the the message itself and the parts encoded as length and info parts. A Message is generally built similar to a Tcl proc call in having a command and some parameters for the command. The command is normally a class object and the first parameter is the action to be executed on a GUI element. The parameter is normally a handle for the GUI element to be worked on and the other parameters are additional info for the action like option and value pairs. The first character of the message shows the type of the message normally M and there will eventually be a type E for end of a message block. That way the protocol is extensible with other types. Right now there exist no other types.

The layout of the message interface is as follows:

  • M<length of message>:<message>
  • <length of message> is the length of the following message text (not including the ”:”) as an integer number

and a message is composed of 1 .. n parts with the following layout:

  • <length of part>:<part>
  • <length of part> is the length of the following message text (not including the ”:”) as an integer number
  • <part> is a sequence of printable ASCII characters.

These messages are interpreted on the client side (or the part which acts as a client for example some class methods). Some examples:
 * M53:9:wtkclient11:createLabel4:obj120:label: Hello Chicago
 * M33:9:wtkclient7:newGrid4:obj05:grid0
 * M38:9:wtkclient4:grid5:grid09:insertRow1:0
 * M48:9:wtkclient4:grid5:grid03:row1:010:insertCell1:0
 * M70:9:wtkclient4:grid5:grid03:row1:04:cell1:011:appendChild7:widgets4:obj1
 * M47:9:wtkclient12:createButton4:obj213:Hello Chicago
 * M70:9:wtkclient4:grid5:grid03:row1:04:cell1:011:appendChild7:widgets4:obj2
 * M38:9:wtkclient12:createButton4:obj34:Quit
 * M70:9:wtkclient4:grid5:grid03:row1:04:cell1:011:appendChild7:widgets4:obj3