Coder Social home page Coder Social logo

jschan's People

Contributors

adrianrossouw avatar azu avatar edef1c avatar mcollina avatar pelger avatar tamagokun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jschan's Issues

remove async dependency

Async is not used very much, just for closing down some stuff. Maybe we can do better and remove it.

TCP Transport ?

Hi,

Is there a plan for a TCP transport ?
I guess that it will have the highest throughput on local network, which is where jschan is going to be used anyway.

protocol error w/ io.js 2.40

see GraftJS/graft#19

events.js:141
      throw er; // Unhandled 'error' event
            ^
Error: Protocol "http:" not supported. Expected "https:".
    at new ClientRequest (_http_client.js:53:11)
    at Object.exports.request (http.js:31:10)
    at ClientSession.newStream [as _createNewStream] (/Volumes/alien/projects/digs/digs-graft/node_modules/jschan/lib/spdy/client.js:104:18)
    at createChannel (/Volumes/alien/projects/digs/digs-graft/node_modules/jschan/lib/spdy/client.js:143:11)
    at ClientSession.WriteChannel (/Volumes/alien/projects/digs/digs-graft/node_modules/jschan/lib/spdy/client.js:157:10)
    at SPDYClient.Client._write (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/lib/client.js:36:30)
    at doWrite (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/node_modules/readable-stream/lib/_stream_writable.js:279:12)
    at writeOrBuffer (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/node_modules/readable-stream/lib/_stream_writable.js:266:5)
    at SPDYClient.Writable.write (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/node_modules/readable-stream/lib/_stream_writable.js:211:11)
    at Graft.ondata (/Volumes/alien/projects/digs/digs-graft/node_modules/graft/node_modules/readable-stream/lib/_stream_readable.js:572:20)

sample application

Build out a simple example app (confer with libchan guys to make sure we are building the right thing)

Automatic object stream piping

Currently, we cannot pass a standard objectMode stream inside a channel with automated piping: we need to create a new channel and pipe.

Is it sound to use that pattern? Plus, solving this issue might be more tricky, because Transform stream are not supported by the automated piping natively, you will need to flag them with something like jschanReadable or jschanWritable.

Any opinions on this?

end and finish event not firing via SPDY

I am creating an array of fs.createReadableStreams and putting them into a message. This message is then passed to my jschan/graft microservice, which pipes each file it into local fs.createWritableStreams.

Data, end, and finish events fire correctly when I am using the in-memory graftJS, and also when using spdy on localhost with a small file (< 3746 bytes). However, all three of the same events fail to fire when sending larger files over spdy jschan.

Node version is v0.10.35

Sender:

    // Convert filePaths into filestreams that can be sent via graft jschan
    if (msg.filePaths) {
      var fileStreams = {};
      msg.filePaths.forEach(function(filePath) {
        var fileName = path.basename(filePath);
        //var zlibCompress = zlib.createDeflate();
        var fileStream = fs.createReadStream(filePath);

        fileStream.resume();
        fileStream.on('data', function(chunk) {
          console.log('got %d bytes of data', chunk.length);
        });
        fileStream.on('end', function() { console.log('end'); });

        fileStreams[fileName] = fileStream;
      });
      msg.fileStreams = fileStreams;
    }

Receiver:

        // Save remote fileStreams to local temp directory.
        async.map(Object.keys(msg.fileStreams), function _writeStream(fileName, cb) {
          var fileStream = msg.fileStreams[fileName];
          var outPath = path.join(dirPath, fileName);
          var outStream = fs.createWriteStream(outPath);
          console.log(outPath);

          // end event does not fire
          fileStream.resume();
          fileStream.on('data', function(chunk) {
            console.log('got %d bytes of data', chunk.length);
          });
          fileStream.on('end', function() { console.log('end'); });

          // finish event does not fire 
          fileStream.pipe(outStream).on('error', function(err) {
            setImmediate(cb, err);
          }).on('finish', function() {
            setImmediate(cb, null, outPath);
          });

        }, function(err, filePaths) {
          if (err) { cleanupTmp(); throw err; }
          ...
        });

Would really appreciate the help nailing this bug down.

Unix transport

Let's first let the libchan guys how they want to roll out that in libchan.

Passing Channels between Sessions

Currently a channel, once created, can be serialized only within the session that has originated it.

This means that I cannot route the messages between the services easily, i.e. I cannot send a channel from one user to another client. Currently, this can be done only through explicit piping.

However, I think it's doable to automatic 'fix' this, so when we send a channel bound to another session, it gets automatically piped. What do you think?

Jschan Compatible with node 4.8.3 ?

like the title, is jschan compatible with node 4.8.3?
if there is already has closed issue related to this, please send me a link here.

Thanks

port usage.md

Port usage.md to node proto-code, so we can see what it's like

port in memory

Port in-memory execution to node so we can try out our api

Message queueing patterns

Write up concerns about message queue patterns and post it in libchan issue queue for official feedback

Rexec example: Golang server does not work with jsChan client

Hello everyone,

Based on an email conversation I had with Matteo, he suggested I open an issue here, as his assumption was that the Node client should work with the Golang server, based on last time he tested it.

Basically, I am testing the Golang libchan rexec server:
https://github.com/docker/libchan/blob/master/examples/rexec/rexec_server/server.go

Against the Node.Js jsChan rexec sample:
https://github.com/GraftJS/jschan/blob/master/examples/rexec/client.js

The versions tested are the ones in master repo as of January 15, 2015.
I had two console windows open, on the same server. One running a compiled golang version of libchan rexec server, waiting on port 9323.
The other console would be for the client:

  • the golang client run with "rexec echo hi" works correctly
  • the node client, run with "node index.js echo hi" does not work correctly

I added a few log lines in the server, and the approximate location where the server stops being responsive is right after:
t, err := tl.AcceptTransport() (line 63, it passes this one)
and before
receiver, err := t.WaitReceiveChannel() (line 71, it doesn't seem to pass this one, no errors thrown)

In other words, the t.WaitReceiveChannel() does not appear to be responsive to jsChan's channel.

My regards to the team, great work,
Silviu

node-spdy

Research and send a feedback email to this list about node-spdy

Create channels from the global jsChan object

Currently to create a return channel we use:

var jschan  = require('jschan');
var session = jschan.memorySession();
var chan = session.createWriteChannel();
var ret  = chan.createReadChannel();

chan.write( { hello: 'world, ret: ret } );

However it will be much simpler to have:

var jschan  = require('jschan');
var session = jschan.memorySession();
var chan = session.writeChannel(); // shorter
var ret  = jschan.readChannel(); // simpler, channels are derived from the top-level objects, and then passed through. 

chan.write( { hello: 'world, ret: ret } );

Performance Analysis

How this is slower than standard streams?
How this is slower than HTTP?

We just need some numbers, and maybe some optimization tricks.

Encoding

It seems the encoding part of libchan is in a flux at the moment: e.g. they want to support msgpack (ref)[https://github.com/docker/libchan/blob/72754f8294ce601ea4a947a635df3252bb009e2d/PROTOCOL.md], but right now it's netstrings only, and they have a pull request that adds msgpack, but it does not remove netstrings (see docker/libchan#37).

It's completely unclear.

Backpressure problem in stream session

According to the spec at https://nodejs.org/api/stream.html#stream_readable_read_size_1
Note: once the _read() method is called, it will not be called again until the push method is called.

This causes done() to never be called when ByteStream on remote-side has finished and is sending an { id: x } message. When done() is not called, back pressure is not released in session inStream.

stream/channels.js

ByteStream.prototype._read = function() {
74    var done = this._lastDone;
75    if (done) {
76      this._lastDone = null;
77      done();
78    }
79    return null;
80  };

msgpack implementation

According to the internals of libchan, we need a new implementation of msgpack that supports extension points (msgpack changed spec some time ago).
๐Ÿ˜ฑ

Should it be something I put work on? @pelger @Vertice?

Only first frame sent for large objects.

When sending large strings or objects (more than one frame) over a response channel only the first frame appears to be handles correctly. Workaround for now is to use a byte stream. This issue potentially due to a misconfiguration on node-spdy.

.travis.yml

I'm not an owner here, can any of you add travis to this repo? I already added the .travis.yml file.

webrtc transport

we discussed wanting to enable graft/jschan over webrtc data channels too. this issue is to collect some of the related concepts.

Echoed embedded channels break pipes

One of the things I've need to do in aetherboard is to have a writechannel for all my messages to the server, and then a read channel that is meant to contain the merged stream of everybody's messages in the order they were received.

Inside the message I send, I have another write channel that contains a series of messages that I will write to even after the initial message is sent. This is actually not that uncommon. think IRC with the ability to see everybody's text as they type.

Unfortunately the message I receive back from the server, is somehow different for me than for all the other people who receive the message, and beyond that, it is also different to my initial writechannel.

Trying to pipe from it, causes some kind of silent error, and unpipes everything, meaning that my client becomes disconnected.

This behaviour can be reproduced with aetherboard by following this issue :
GraftJS/aetherboard#16

I have written some tests for graft in this PR :
GraftJS/graft#13

I'm pretty sure though that the bug is actually going to be found here in jschan though.

encoder.js possible bug location

I've also noticed that the passing around of the original channel is causing the chan.streams to contain circular references in there.

@mcollina

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.