Skip to content

Commit

Permalink
Rename of sendChannel into createWriteChannel. Updated README and LIC…
Browse files Browse the repository at this point in the history
…ENSE.
  • Loading branch information
mcollina committed Jul 21, 2014
1 parent 0dd9912 commit bcee7aa
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 18 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2013 Peter Elger
Copyright (c) 2014 jsChan Contributors, as listed in the README

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
72 changes: 60 additions & 12 deletions README.md
@@ -1,8 +1,14 @@
# jsChan

### A Node.js port for docker/libchan
__jsChan__ is a Node.js port for docker/libchan based around node streams

__Warning: This project is still in the very early stages of development, and not usable yet__
__Warning: This project is still in the very early stages of development, and not production ready yet__

## Install

```bash
npm install jschan --save
```

## Example

Expand All @@ -24,7 +30,7 @@ session.on('channel', function server(chan) {

function client() {
// chan is a Writable stream
var chan = session.sendChannel();
var chan = session.createWriteChannel();
var ret = chan.createReadChannel();
var called = false;

Expand All @@ -43,26 +49,68 @@ function client() {
client();
```

#### About LibChan
<a name="api"></a>
## API

* <a href="#session">Session Interface</a>
* <a href="#channel">Channel Interface</a>
* <a href="#memorySession"><code>jschan.<b>memorySession()</b></code></a>
* <a href="#sessionCreateWriteChannel"><code>session.<b>createWriteChannel()</b></code></a>
* <a href="#channelCreateReadChannel"><code>channel.<b>createReadChannel()</b></code></a>
* <a href="#channelCreateWriteChannel"><code>channel.<b>createWriteChannel()</b></code></a>
* <a href="#channelCreateWriteChannel"><code>channel.<b>createBinaryStream()</b></code></a>

-------------------------------------------------------
<a name="session"></a>
### Session Interface

-------------------------------------------------------
<a name="channel"></a>
### Channel Interface

-------------------------------------------------------
<a name="memorySession"></a>
### jschan.memorySession()

-------------------------------------------------------
<a name="session.createWriteChannel"></a>
### session.createWriteChannel()

It's most unique characteristic is that it replicates the semantics of go channels across network connections, while allowing for nested channels to be transferred in messages. This would let you to do things like attach a reference to a remote file on an HTTP response, that could be opened on the client side for reading or writing.
-------------------------------------------------------
<a name="channel.createReadChannel"></a>
### channel.createReadChannel()

The protocol uses SPDY as it's default transport with MSGPACK as it's default serialization format. Both are able to be switched out, with http1+websockets and protobuf fallbacks planned.
-------------------------------------------------------
<a name="channel.createWriteChannel"></a>
### channel.createWriteChannel()

While the RequestResponse pattern is the primary focus, Asynchronous Message Passing is still possible, due to the low level nature of the protocol.
-------------------------------------------------------
<a name="channel.createBinaryStream"></a>
### channel.createBinaryStream()

### About Graft
## About LibChan

The Graft project is formed to explore the possibilities of a web where servers and clients are able to communicate freely through a microservices architecture.
It's most unique characteristic is that it replicates the semantics of go channels across network connections, while allowing for nested channels to be transferred in messages. This would let you to do things like attach a reference to a remote file on an HTTP response, that could be opened on the client side for reading or writing.

> "instead of pretending everything is a local function even over the network (which turned out to be a bad idea), what if we did it the other way around? Pretend your components are communicating over a network even when they aren't."
The protocol uses SPDY as it's default transport with MSGPACK as it's default serialization format. Both are able to be switched out, with http1+websockets and protobuf fallbacks planned.

While the RequestResponse pattern is the primary focus, Asynchronous Message Passing is still possible, due to the low level nature of the protocol.

## About Graft

The Graft project is formed to explore the possibilities of a web where servers and clients are able to communicate freely through a microservices architecture.

> "instead of pretending everything is a local function even over the network (which turned out to be a bad idea), what if we did it the other way around? Pretend your components are communicating over a network even when they aren't."
> [Solomon Hykes](http://github.com/shykes) (of Docker fame) on LibChan - [[link]](https://news.ycombinator.com/item?id=7874317)
[Find out more about Graft](https://github.com/GraftJS/graft)


#### Contributors
## Contributors

* [Adrian Rossouw](http://github.com/Vertice)
* [Peter Elgers](https://github.com/pelger)
* [Matteo Collina](https://github.com/mcollina)

## License

MIT
2 changes: 1 addition & 1 deletion example.js
Expand Up @@ -14,7 +14,7 @@ session.on('channel', function server(chan) {
});

function client() {
var chan = session.sendChannel();
var chan = session.createWriteChannel();
var ret = chan.createReadChannel();
var called = false;

Expand Down
2 changes: 1 addition & 1 deletion lib/memorySession.js
Expand Up @@ -84,7 +84,7 @@ function MemorySession(server) {

util.inherits(MemorySession, EventEmitter);

MemorySession.prototype.sendChannel = function sendChannel() {
MemorySession.prototype.createWriteChannel = function createWriteChannel() {
var chan = new MemoryChannel(this);
var count = EventEmitter.listenerCount(this, 'channel');

Expand Down
6 changes: 3 additions & 3 deletions test/abstract_session.js
Expand Up @@ -17,7 +17,7 @@ module.exports = function abstractSession(inBuilder, outBuilder) {
describe('basic reply subChannel', function() {

function client(done) {
var chan = outSession.sendChannel();
var chan = outSession.createWriteChannel();
var ret = chan.createReadChannel();

ret.on('data', function(res) {
Expand Down Expand Up @@ -68,7 +68,7 @@ module.exports = function abstractSession(inBuilder, outBuilder) {
describe('write subChannel', function() {

function client() {
var chan = outSession.sendChannel();
var chan = outSession.createWriteChannel();
var more = chan.createWriteChannel();

chan.write({
Expand Down Expand Up @@ -125,7 +125,7 @@ module.exports = function abstractSession(inBuilder, outBuilder) {
describe('binaryStream', function() {

function client(done) {
var chan = outSession.sendChannel();
var chan = outSession.createWriteChannel();
var bin = chan.createBinaryStream();

chan.write({
Expand Down

0 comments on commit bcee7aa

Please sign in to comment.