rsms / gotalk

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

StreamReqPart+ -> StreamReqPart* #8

Closed alecthomas closed 9 years ago

rsms commented 9 years ago

Actually, + is intended to indicate that an empty streaming request makes no sense (it's practically equivalent to a buffered empty request.) However, as the ABNF indicates payload (which might be empty, indicating "end of streaming request") you are correct.

Not sure what the best design here is though — to allow non-sensical empty streaming requests with the upside of a slightly simpler protocol spec, or to redefine it as:

StreamRequest   = "s" requestID operation nePayload StreamReqPart+
nePayload = nePayloadSize payloadData
nePayloadSize = hexUInt8{>=1}

Thoughts?

alecthomas commented 9 years ago

I think that although it is a little bit non-obvious to have empty streaming requests, it's likely that internal logic on clients could generate such a request. eg. uploading an array of IDs that happen to be zero length. In my opinion it is logically consistent and I prefer the simplicity.