Changes between Version 1 and Version 2 of specification


Ignore:
Timestamp:
01/24/2006 04:34:08 AM (12 years ago)
Author:
Jan-Klaas Kollhof
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • specification

    v1 v2  
    7070== 3. JSON Class hinting == 
    7171There are only simple data types defined in JSON. 
    72 To overcome this problem in a JSON compatible way a special property for objects is introduced. 
    73 {{{{"__jsonclass__":["constructor", [param1, ], "prop1": ...}}}} 
     72To overcome this problem in a JSON compatible way a special property for objects is introduced.[[BR]] 
     73{{{{"__jsonclass__":["constructor", [param1, ], "prop1": ...}}}}[[BR]] 
    7474The object is then instanciated using the constructor passing the parameters. 
    75 Once constructed the properties will be applied. 
     75Once constructed the properties(propwill be applied. 
     76 
     77 
     78== 4. Communication Examples == 
     79 
     80--> data sent to service[[br]] 
     81<-- data coming from service 
     82 
     83 * {{{service.echo("Hello JSON-RPC")}}} 
     84 
     85{{{ 
     86#!javascript 
     87--> { method: "echo", params: ["Hello JSON-RPC"], id: 1} 
     88<-- { result: "Hello JSON-RPC", error: null, id: 1} 
     89}}} 
     90 
     91 * multiple request responses 
     92This example shows parts of a communication from an example chat application. 
     93The chat service sends notofications for each chat message the client peer  should receive. 
     94The client peer sends requests to post messages to the chat and expects a positive reply to know the message has been posted. 
     95 
     96 
     97{{{ 
     98#!javascript 
     99... 
     100 
     101--> {method: "postMessage", params: ["Hello all!"], id: 99} 
     102 
     103<-- {result: 1, error: null, id: 99} 
     104 
     105<-- {method: "handleMessage", params: ["user1", "we were just talking about you", id: null} 
     106 
     107<-- {method: "handleMessage", params: ["user3", "sorry, gotta go now, ttyl"], id: null} 
     108 
     109--> {method: "postMessage", params: ["I have a question:", id : 101} 
     110 
     111<-- {method: "userLeft", params: ["user3"], id: null} 
     112 
     113<-- {result: 1, error: null, id: 101} 
     114 
     115... 
     116}}} 
     117 
     118 
     119 
     120