docker / libchan

Like Go channels over the network
Apache License 2.0
2.47k stars 142 forks source link

Proposal: Channel reference identifiers #51

Closed dmcgowan closed 9 years ago

dmcgowan commented 9 years ago

Background

Currently the libchan protocol does not define the mechanism for connecting both ends of a channel. This leaves it up the implementer to either use the underlying spdy stream id or something custom. Using the spdy stream id should not be used since the identifier is part of a lower and separate layer and depending on the spdy implementation may not be accessible. In order for clients to be compatible the protocol should have channels define an identifier in the same way as byte streams and communicate that identifier through the spdy headers. The channel header can use the same reference id space as byte streams and be distinguished by the existance of a parent identifier (which byte streams do no have since they do not have hiearchy).

Proposal

I am proposing adding a 'libchan-parent-ref' spdy header to be used when creating channels and requiring both channels and byte streams to make use of the existing 'libchan-ref' header. The decision on whether a new stream is a channel will then be made by the existance of 'libchan-parent-ref' rather the absence of 'libchan-ref'. The msgpack object will then communicate the reference identifer rather than anything custom or the spdy stream id.

dmcgowan commented 9 years ago

@shykes I have a PROTOCOL.md change for this already which I can create a PR for later. Also a working implementation of it which @mcollina and I used to build a cross-language working example. That PR will need to come after the bigger merge.

dmcgowan commented 9 years ago

I was rebasing my code and noticed that the implementation of this did make its way into #38. Easy update depending on what we decide, does not change the library interface. Rebasing #38 to remove this is not worth it.

mcollina commented 9 years ago

The link to the node-based version which is compatibley with this change is here: https://github.com/GraftJS/jschan

Great work @dmcgowan!

dmcgowan commented 9 years ago

Already in master and will be in 0.1.0 tag