GithubHelp home page GithubHelp logo

reliable's Introduction

Reliable transfer over DataChannels

Reliable

new Reliable(dc): A reliable utility class for DataChannel. Takes in a DataChannel object.

  • .send(msg): Takes any message and sends it reliably.
  • .onmessage(msg): Called when data is received.

Reliable.higherBandwidthSDP(sdp): This need to be applied to all offer/answer SDPs for Reliable to function properly. Returns the new SDP with added bandwidth. See usage below.

// Assuming 2 PeerConnections pc1, pc2.
pc1.createOffer(function(offer) {
  offer.sdp = Reliable.higherBandwidthSDP(offer.sdp);
  pc1.setLocalDescription(offer, ...);
});

...

// Same process for answer.
pc2.createAnswer(function(answer) {
  answer.sdp = Reliable.higherBandwidthSDP(answer.sdp);
  pc2.setLocalDescription(answer, ...);
});

Internal message format

ACK

This is an ACK for a chunk of the message.

[
  /* type */  'ack',
  /* id */    message_id,
  /* ACK */   n   // The next chunk # expected.
]

Chunk

This is a chunk of the message.

[
  /* type */  'chunk',
  /* id */    message_id,
  /* n */     n,       // The chunk #.
  /* chunk */ chunk   // The actual binary chunk.
]

END

This is the end of a message.

[
  /* type */  'end',
  /* id */    message_id,
  /* n */     n       // The last index.
]

Unchunked message

This is a message that was able to be sent without being chunked.

[
  /* type */  'no',
  /* msg */   payload
]

Future plans

Use stream API.

reliable's People

Contributors

kevinsawicki avatar michelle avatar

Watchers

 avatar

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.