Article: ()
The Messaging System Between the TSI Servers,TSI Services and TSI Clients is "proprietary". Such a word sends alarm bells ringing in the ears of many. It is easy to document the message structure and that follows.
The proprietary nature is the flow of messages needed to load the client with data.
The Message Definition
[mn][ml][ ]
[mn][ml][data][rc][data]
short,short,void
short,short,void,short,void.
In Sql terms the syntax: Select A.*,B.* From TableA A, TableB B Where A.id=B.fkid has the potential for repetition in the A.* part of the DataSET
Message: Complete Parent Child JSON Form
DescribeData[Bytes]Type
MessageID 1000 [2], short
Message Size40 [2], short
Contract GBP*USD/OA [10], char[10]
RepeatCount 2 [2], short
Expiry15/06/2013{1} [4],long
Strike3000 [2],short
PC AB [2],char[2]
Field £$%& {/1}[4],void[4]
Expiry15/09/2013{2} [4],long
Strike6000 [2],short
PC CD [2],char[2]
Field *()_ {/2}[4],void[4]
Total Bytes[40]
^1000^40^GBP-USD/OA^2^15/06/2013^3000^AB^£$%&^15/09/2013^6000^CD^*()_^ is a characterisation. Note: ^ may well cause problems as an actual data character.
var viewMode = {
    Parents: [
        { ID: 1, Name: "Beverages", 
            Children: [
                { ProductID:  1, Name: "Chai",        UnitPrice: 18.00, UnitsInStock: 39, Discontinued: "No" },
                { ProductID:  2, Name: "Chang",       UnitPrice: 19.00, UnitsInStock: 17, Discontinued: "No" },
                { ProductID: 24, Name: "Guaraná",     UnitPrice:  4.50, UnitsInStock: 35, Discontinued: "Yes" }
            ]
        },
        { ID: 8, Name: "Seafood", 
            Children: [
                { ProductID: 45, Name: "Røgede sild", UnitPrice:  9.50, UnitsInStock: 19, Discontinued: "No" },
                { ProductID: 46, Name: "Spegesild",   UnitPrice: 12.00, UnitsInStock: 49, Discontinued: "No" },
                { ProductID: 58, Name: "Escargots",   UnitPrice: 13.25, UnitsInStock: 60, Discontinued: "No" },
                { ProductID: 73, Name: "Röd Kaviar",  UnitPrice: 15.00, UnitsInStock: 18, Discontinued: "No" }
            ]
        }
    ]
};
#message AnyAnyCategoryProductReply = 1 
#instruct SERVER,E,CLIENT,D
ID, 
Name 
#define SUB,2,Repeat 
ProductID, 
Name,        
UnitPrice, 
UnitsInStock, 
Discontinued 
#end sub
#messageEnd	
    
#message AnyAnyParentChildReply = 1000
#instruct SERVER,E,CLIENT,D
Contract
#define SUB,2,Repeat
Expiry,
Strike,
PC,
Field
#end sub
#messageEnd	
The Server can Encode (write) and the Client can Decode (read) the messsage above.
#instruct SERVER,ED,CLIENT,ED would create both read and write methods in the Message Classes.
Doubles of eight bytes are not supported due to a lack of edian knowledge { unsigned_short = (unsigned_short >> 8) | unsigned_short << 8); ) } { ulL = (ulL >> 24) | ((ulL >> 8) & 0xFF00) | ((ulL << 8) & 0xFF0000) | (ulL << 24); } The following is a visual reprentation of message number 1000 with a length of 12 : [1000][12][........] The Message With Structured Repeating Detail The message can be more complex where Repeating Detail is appended to the message. Two bytes that preface are a record count the amount of bytes that follow. Therefore using 24 bytes of data we have possible 1 x 24, 2 x 12, 3 x 8, 4 x 6 and vice versa. Example is 2 records [12 bytes each] where each record has 4 four fields of 2,2,2,4 bytes respectively. At the extreme a RepeatCount=1 and record length of 24 begins to look like a main message with a wrongly repeating field. [mn][ml][..........][rc][.... .. .. ....|.... .. .. ....] 2, 2, 10,[ 2], 4, 2, 2, 4 4, 2, 2, 4 = 40 1000|40|X|2|X| Note, there is no way of telling without the schema, whether the thirty six bytes of data [ X|2|X ] are just data or a repeat listing. To create the socket reading and writing classes on a per message basis requires an Interface Definition Language. The key words are "#scheme" < >, "#schemaEnd", "$type" <, , >, "#dictionary","#dictionaryEnd", "#message" < = >, "#instruct" < , , , >, "#define", "#end" < > Field Names of "SERVER", "CLIENT" and "SUB" may not scope through the code generator. When the code generator encounters a ; it treats that and the rest of the line as a comment. The code generator is a line reader, it does not support more than one script instruction a line. #schema ETS $type , long , LONG $type , int , INT $type , short , SHORT $type , char , CHAR $type , bool , UCHAR ; Comments Java: $type,byte,UCHAR $type , char , IDTSI ; Comments Java : $type , byte , IDCHAR #dictionary MNO,Message Number,2,SHORT LEN,Message Length,2,SHORT SUB, Reserved Word,2,SHORT Contract,Description of Field, 10,CHAR Expiry ,Date When Trading Stops, 4,LONG Strike ,Price or Rate, 2,SHORT PC ,Two Characters, 2,CHAR Field ,Yet Another Field, 4,CHAR #dictionaryEnd #message CmeWepContractMarket = 1000 #instruct SERVER,ED,CLIENT,D Contract, #define SUB,2,Repeat Expiry, Strike, PC, Field #end sub #messageEnd #schemaEnd
section
article
Header

Wilmott Online Technical Forum For Derivative Experts   http://channel9.msdn.com/Events/TechEd/Europe/2012/DEV213   channel9 msdn Series: Building-Web-Apps-with-ASP-NET 01-Whats-New-in-ASPNET-45   Damian Edwards and David Fowler Demonstrate SignalR