rsms / gotalk

Async peer communication protocol & library
MIT License
1.2k stars 76 forks source link

Possible Notification discrepancy #1

Closed gtaylor closed 9 years ago

gtaylor commented 9 years ago

I noticed the following example:

+---------------------- Notification
|              +--------- type        "chat message"
|              |       +- payloadSize 50
|              |       |
n00cchat message00000032{"message":"Hi","from":"nthn","chat_room":"gonuts"}

With the following definition:

Notification    = "n" type payload

type            = text3
payload         = payloadSize payloadData?
payloadSize     = hexUInt8
payloadData     = <byte>{payloadSize}

text3           = text3Size text3Value
text3Size       = hexUInt3
text3Value      = <<byte>{text3Size} as utf8 text>

It looks like the text3 isn't documented in the example. Should be:

+---------------------- Notification
|  +--------------------- text3Size   12
|  |           +--------- type        "chat message"
|  |           |       +- payloadSize 50
|  |           |       |
n00cchat message00000032{"message":"Hi","from":"nthn","chat_room":"gonuts"}

This tripped me up a little when working on a quick and dirty Python implementation: https://github.com/gtaylor/python-gotalk

rsms commented 9 years ago

Good catch. However text3Size has been omitted for the sake of readability. The same is done with the StreamRequest example.