You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lennart Grahl 7031d82e56 Add test for Uint8Array and Int32Array views with offset 1 anno fa
.circleci Switch to CircleCI 2 anni fa
dist Release v0.13.0 1 anno fa
rollup Upgrade rollup and other dependencies 1 anno fa
src Send optimisations & don't ignore Uint8Array offsets 1 anno fa
tests Add test for Uint8Array and Int32Array views with offset 1 anno fa
.editorconfig Update .editorconfig 3 anni fa
.gitignore Setup testing and distribution 3 anni fa Release v0.13.0 1 anno fa Upgrade copyright year 1 anno fa Improve README 1 anno fa Release v0.12.1 1 anno fa
karma.conf.js Increase karma browser timeout 2 anni fa
package-lock.json Release v0.13.0 1 anno fa
package.json Fix apply the log level on SecureDataChannel 1 anno fa
saltyrtc-task-webrtc.d.ts Add log level (defaults to 'none') 1 anno fa
tsconfig.json Switch to dependencies in @saltyrtc organization 2 anni fa

SaltyRTC WebRTC Task for JavaScript

CircleCI Supported ES Standard npm Version npm Downloads License Chat on Gitter

This is a SaltyRTC WebRTC task implementation for JavaScript (ES5 / ES2015), written in TypeScript 2.

Warning: This is beta software. Use at your own risk. Testing and review is welcome!


Via npm

You can install this library via npm:

npm install --save @saltyrtc/task-webrtc @saltyrtc/client


When creating the task instance, you can specify whether or not a handover to a secure data channel is desired.

let task = new WebRTCTask(true);

You can also specify the max DataChannel chunk size:

let task = new WebRTCTask(true, 65536);

If you don’t specify any values, handover defaults to true and the chunk size defaults to 16384.

The handover can be initiated using the handover method:

let started = task.handover(peerConnection);

Note: You should call this method before creating offer/answer!

To send offers, answers and candidates, use the following task methods:

  • .sendOffer(offer: RTCSessionDescriptionInit): void
  • .sendAnswer(answer: RTCSessionDescriptionInit): void
  • .sendCandidate(candidate: RTCIceCandidateInit): void
  • .sendCandidates(candidates: RTCIceCandidateInit[]): void

You can register and deregister event handlers with the on, once and off methods:

task.on('candidates', (e) => {
    for (let candidateInit of {

The following events are available:

  • offer(saltyrtc.tasks.webrtc.Offer): An offer message was received.
  • answer(saltyrtc.tasks.webrtc.Answer): An answer message was received.
  • candidates(saltyrtc.tasks.webrtc.Candidates): A candidates message was received.
  • disconnected(number): A previously authenticated peer disconnected from the signaling server.

To know when the handover is finished, please subscribe to the handover event on the client directly.


To compile the test sources, run:

$ npm run rollup_tests

Then simply open tests/testsuite.html in your browser!

Alternatively, run the tests automatically in Firefox and Chrome:

$ npm test


Responsible Disclosure / Reporting Security Issues

Please report security issues directly to one or both of the following contacts:

Coding Guidelines

  • Write clean ES2015
  • Favor const over let


MIT, see