Giter Club home page Giter Club logo

bpmux's Introduction

This version is for ruhohSpec v2.1 and is only compatible with ruhoh 2.1.x

A default blog scaffold for ruhoh compatible static blog parsers.

Usage

ruby 1.9.2+

Clone the Blog Scaffold

$ git clone git://github.com/ruhoh/blog.git blog
$ cd blog

Get Bundler

It is recommended to use bundler to manage ruhoh versions.

Do you have bundler?

$ bundle -v

If it's not found, install it:

$ gem install bundler

More info on bundler: http://gembundler.com/

Bundle Install

This blog ships with its own Gemfile. All you need to do is install the bundle.

Navigate to the root of this repository and execute:

$ bundle install

Run Ruhoh from the Bundle

Once the bundle is completed, run:

$ bundle exec rackup -p 9292

This starts a web server that hosts your blog here: http://localhost:9292

To access the bundled ruhoh (2.1) you'll need precede your commands with bundle exec:

$ bundle exec ruhoh help

Run without Bundler

To omit calling bundler with every command download the gem into your global environment:

$ gem install ruhoh

Now you can make calls without bundler:

$ ruhoh help
$ ruhoh console

Note this will set ruhoh to the latest version so you can no longer easily switch across ruhoh versions.

Make it Your Own

The origin initially points to: [email protected]:ruhoh/blog.git

To add your own remote, first create a new repository on GitHub. ex: [email protected]:USERNAME/my-ruhoh-blog.git

$ git remote rm origin
$ git remote add origin [email protected]:USERNAME/my-ruhoh-blog.git

Now you can add your own content and push it to your repository:

$ git add .
$ git commit -m 'some new content'

Upgrading

Upgrade Reference

It's best to first get a fresh blog installed and running locally via bundler as outlined. Next you'll want to compare your existing ruhoh 1.x and 2.0.alpha blog to the newest blog scaffold.

Once you've converted your existing blog, try running it with ruhoh 2.1 by copying the Gemfile into your existing blog and running it with bundler as outlined above.

Help

Feel free to submit installation and upgrading issues via GitHub Issues They can be basic trouble-shooting questions.

Also contact me via:

Documentation

See http://ruhoh.com/docs/2 for full usage and documentation.

License

Released under the MIT License

bpmux's People

Contributors

davedoesdev avatar

Stargazers

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

Watchers

 avatar  avatar

bpmux's Issues

Get working on Node 10

Currently broken because frame-stream (correctly) just pushes buffers but Node has changed (yet again) stream implementation to have a buffer list and return concatenated buffers received. (readable is emitted in nextTick so all the buffers accumulate in the linked list of buffers). This means frameEnd gets lost.

Fix will be to pipe the frame-stream to our handler.

Question: message boundaries support

Hi, First, thank you a lot for bpmux. Both are great: the idea and the implementation!

Now a bit of context on the question. My usecase involves node streams in objectMode where objects are serialized to JSON and then passed down to multiplexed streams (via BPMux). All goes well until it has to pass down a buffer longer then 16384 bytes. Buffers above this length are getting split into parts and receiver gets the message part by part. Obviously it breaks my naive implemented (de)serialization, which could be fixed i.e. I need to prefix messages with their lengths by myself.
While investigating this, I found next things:

  • This library uses frame-stream under the hood, which does length prefixing and should keep message boundaries (at least if I got it right).
  • frame-stream is able to handle messages which are less then 2^32 in length (more than 16384 bytes).
  • Almost all tests I've seen verify concatenated buffers. So, no checks for single messages are there.
  • Input stream created by BPMux is unbuffered frame-stream, which seems to be right.

So, the question: Does bpmux support keeping message boundaries for such cases?

Thanks!

Tests fail on Node 20.9.0

21:36 $ node -v
v20.9.0
✔ ~/github/bpmux [master|…1]
23:20 $ grunt test
Running "exec:certs" (exec) task

Running "mochaTest:default" (mochaTest) task


  tcp aho=false coa=false
    ✔ (x1, client initiated) should support fragmented data
    ✔ (x1, server initiated) should support fragmented data
    ✔ (x1, client initiated) should support fragmented data when read(0) sends status message (2005ms)
    ✔ (x1, server initiated) should support fragmented data when read(0) sends status message (2004ms)
    ✔ (x1, client initiated) should support not parsing handshake data
    ✔ (x1, server initiated) should support not parsing handshake data
    ✔ (x1, client initiated) should pass this as mux in parse_handshake_data
    ✔ (x1, server initiated) should pass this as mux in parse_handshake_data
    ✔ (x1, client initiated) should emit an error if handshake message length too short
    ✔ (x1, server initiated) should emit an error if handshake message length too short
    ✔ (x1, client initiated) should emit an error if pre-handshake message length too short
    ✔ (x1, server initiated) should emit an error if pre-handshake message length too short
    ✔ (x1, client initiated) should emit an error if status message length too short
    ✔ (x1, server initiated) should emit an error if status message length too short
    ✔ (x1, client initiated) should support small high-water marks
    ✔ (x1, server initiated) should support small high-water marks
    ✔ (x1, client initiated) should not deliver data if duplex has ended
    ✔ (x1, server initiated) should not deliver data if duplex has ended
    1) "after each" hook for "(x1, server initiated) should not deliver data if duplex has ended"
    2) "after each" hook for "(x1, server initiated) should not deliver data if duplex has ended"


  18 passing (4s)
  2 failing

  1) tcp aho=false coa=false
       "after each" hook for "(x1, server initiated) should not deliver data if duplex has ended":
     Uncaught AssertionError: expected 'expected handshake, got: 4' to be one of [ 'write after end', …(7) ]
      at BPMux.mux_error_listener (test/test_comms.js:228:39)
      at BPMux.emit (node:events:514:28)
      at BPMux.emit (node:domain:488:12)
      at BPMux._process_header (index.js:1130:18)
      at Writable.write [as _write] (index.js:913:29)
      at writeOrBuffer (node:internal/streams/writable:447:12)
      at _write (node:internal/streams/writable:389:10)
      at Writable.write (node:internal/streams/writable:393:10)
      at exports.Decoder.ondata (node:internal/streams/readable:817:22)
      at exports.Decoder.emit (node:events:526:35)

  2) tcp aho=false coa=false
       "after each" hook for "(x1, server initiated) should not deliver data if duplex has ended":
     Error: done() called multiple times in hook <tcp aho=false coa=false "after each" hook for "(x1, server initiated) should not deliver data if duplex has ended"> of file /home/pfalba/github/bpmux/test/test_tcp.js
      at Object.onceWrapper (node:events:628:28)
      at Server.emit (node:events:514:28)
      at Server.emit (node:domain:488:12)
      at emitCloseNT (node:net:2273:8)
      at process.processTicksAndRejections (node:internal/process/task_queues:81:21)



Warning: Task "mochaTest:default" failed. Use --force to continue.

Handshake needs to establish a round-trip network overhead

Handshake needs to establish a round-trip network overhead. I hope to change it to http2, and each connection has its own ID. The underlying network has been established and there is no need to shake hands at a time. You shake hands like this, which is an extra network overhead. This is very bad

Duplexes not removed when TYPE_END is received

If the remote part of a connection closes a duplex by sending a TYPE_END packet via .end() the local duplex isn't removed / closed fully.

I believe the logic for handling TYPE_END packets should also destroy the duplex here:

bpmux/index.js

Line 1017 in 72ad2b1

duplex.push(null);

Currently from the docs it doesn't appear to be a another way for detecting when the remote closes a connection apart from looking at the internal BPDuplex._ended.

general question

Hello,

I use the following package to stream json data over tls connections from/to a client /server over a tls connection.

It's using JSONStream as a parser/streamer and wait for the response using Promises after the request was sent.

It's doing the work but looking at your repo I was wondering if I could not handle that directly using duplex streams.

I'm just not sure how to implement it, is it like the "ping/pong" test ? As I'm using TLS socket,is it fine too as long as I provide a stream ?

Thanks by advance.

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.