Right - so change it to something like this then?

// In waveclient-rpc.proto
message WebSocketRPCMessage {
  required uint32 version = 1;
  required uint64 sequence_number = 2;
  required string message_type = 3; // We wouldn't actually need this anymore...

  // At least one of these must be set
  optional ProtocolOpenRequest open_request = 10;
  optional ProtocolWaveletUpdate wavelet_update = 11;
  optional ProtocolSubmitRequest submit_request = 12;
  optional ProtocolSubmitResponse submit_response = 13;
  // .... more added later?
}


... And pretty printed, the JSON message looks like this:
{
 "1":0,
 "2":1,
 "3":"webserver.ProtocolOpenRequest",
 "10":
 {
   "1":"[email protected]",
   "2":indexwave!indexwave",
   "3":[""]
 }
}

Doing that trick with a series of optional message types can make
parsing faster than if you send the type as another string. (You can
be sure you'll always have parsed the key before the message, so you
know the message's type. That lets you read it directly without using
intermediate representations.)

-Joseph


On Thu, May 13, 2010 at 9:28 AM, J.D. Zamfirescu <[email protected]> wrote:
> Hey!
>
> That would be great. In fact, what we want to do is further use the
> protobuf indexes instead of the key names. If you can pull this off on
> the client and server that would also be excellent.
>
> And, yes, a version number bump would be great, and we are working on
> client-side websocket stuff but we need to do this anyway. :)
>
> Thanks!
>
> J.D.
>
>
> On Wed, May 12, 2010 at 6:06 PM, Joseph Gentle <[email protected]> wrote:
>> There's a couple changes I'd like to make to the fedone websocket
>> message protocol:
>> - The JSON currently has inconsistent naming conventions
>> (sequenceNumber vs participant_id - see below)
>> - WebSocketChannel.MessageWrapper should embed the message as a JSON
>> object, not a JSON object encoded inside a string. (The latter is
>> sloppy to send and use).
>>
>> Currently messages look like this:
>> {
>>  "version":0,
>>  "sequenceNumber":1,
>>  "messageType":"waveserver.ProtocolOpenRequest",
>>  "messageJson": "{
>>    \"participant_id\": \"[email protected]\",\"wave_id\":
>> \"indexwave!indexwave\",\"wavelet_id_prefix\": [\"\"]}"
>> }
>>
>> ... I'd like to change it to this:
>> {
>>  "version":0,
>>  "sequence_number":1,
>>  "message_type":"webserver.ProtocolOpenRequest",
>>  "message":
>>  {
>>    "participant_id":"[email protected]",
>>    "wave_id":indexwave!indexwave",
>>    "wavelet_id_prefix":[""]
>>  }
>> }
>>
>> Questions:
>> - Should I just write & submit a patch? Who should I send it to?
>> - Should I bump the protocol version number for a change like this?
>> - How many people are effected by changes like this? (Are many people
>> working on client code using websockets?)
>>
>> Cheers
>> Joseph
>>
>

-- 
You received this message because you are subscribed to the Google Groups "Wave 
Protocol" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/wave-protocol?hl=en.

Reply via email to