Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Protocol 0.2.0 #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Protocol 0.2.0 #86

wants to merge 1 commit into from

Conversation

dmcgowan
Copy link
Contributor

Update to the protocol as a result of libchan meeting with Matteo Collina.
Bump the version to 0.2.0 and name the set the previous version as 0.1.0.

Protocol changes:

  • Define stream provider to support multiple multiplexing protocols
  • Support CBOR in addition to Msgpack for channel message encoding
  • Add extended type codes definition
  • Require byte-streams to send "libchan-parent-ref"
  • Allow byte-streams as duplex or half-duplex
  • Add channel synchronization through ack definition
  • Add channel errors
  • Update description of relationship to Go channels

Other changes:

  • Add Derek and Matteo to authors
  • Reformatted to 80 character lines
  • Much cleanup and rewording

@dmcgowan
Copy link
Contributor Author

Ping @mcollina for review of initial draft

Matteo, I am still uncertain about the method for doing acks, you were as well. Think of possibly keeping acks much simpler, a simple integer message, 0 for non-error ack, and > 0 for error ack. When an error is received a string message can follow, then a remote close. If no string message is given then the close should still happen resulting in an EOF. The simple integer type will work well with msgpack and cbor as most messages will only end up being a single byte.

A `channel` is an object which allows 2 concurrent programs to communicate with
each other. The semantics of a libchan channel are very similar (but not
identical) to those of Go's native channels. A channel may be used
synchronously, but do not support Go's channel select semantics.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add:

"For those not familiar with Go, this means it does not support any synchronization primitives".

@dmcgowan dmcgowan added this to the v0.2.0 milestone Feb 17, 2015
@mcollina
Copy link
Contributor

mcollina commented Mar 8, 2015

Sorry for not reading this through sooner, I was stuck in the consulting businness :(. I think we should add a header for the message encoding. This is necessary to ensure things works with different encodings.

I propose to add a mime type of application/libchan+msgpack5 or application/libchan+cbor.

Should I send a PR against this PR with my updates?

Thanks for adding me as an author 👯.

@dmcgowan
Copy link
Contributor Author

Excellent point, any newly created stream which will send data should have a content-type.

Types

  • application/vnd.libchan.send+msgpack5 - Encoded messages in msgpack5
  • application/vnd.libchan.recv+msgpack5 - Encoded responses in msgpack5
  • application/vnd.libchan.send+cbor - Encoded messages in cbor
  • application/vnd.libchan.recv+cbor - Encoded responses in cbor
  • application/octet-stream - Byte stream

@dmcgowan
Copy link
Contributor Author

Updated based on original feedback, still need to update for content types

@mcollina
Copy link
Contributor

👍 for the types.

Just one question: what happens if the other party does not support that encoding?

@dmcgowan
Copy link
Contributor Author

I think the ":status" as used currently in spdy and defined in HTTP is missing here. I will add ":status" as the response header which should contain an HTTP status code. In the case of unsupported content-type, a 415 would be used.

@dmcgowan
Copy link
Contributor Author

Hmm looking more at the streams interface, I am thinking streams will need to have a function to handle the reply unless it would be expected the stream provider would be configured to know how to accept content-types and expose that to the stream user. My goal would be after a new stream is accepted, it is always good and would never need to explicitly failed by the stream user because of invalid content-type.

Update to the protocol as a result of libchan meeting with Matteo Collina.
Bump the version to 0.2.0 and name the set the previous version as 0.1.0.

Protocol changes:
 - Define stream provider to support multiple multiplexing protocols
 - Support CBOR in addition to Msgpack for channel message encoding
 - Add extended type codes definition
 - Require byte-streams to send *"libchan-parent-ref"*
 - Allow byte-streams as duplex or half-duplex
 - Add channel synchronization through ack definition
 - Add channel errors
 - Update description of relationship to Go channels
 - Add stream content type

Other changes:
 - Add Derek and Matteo to authors
 - Reformatted to 80 character lines
 - Much cleanup and rewording

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
@dmcgowan
Copy link
Contributor Author

Finally pushed the update. Going to revive this and get this work completed.

@dmcgowan
Copy link
Contributor Author

Updated with last comments and content types

Pushed an update to the streams library in support of this change dmcgowan/streams@f02a9e7. This will enable proper content type handling by libchan.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants