# rtc-taskqueue

> An asynchronous task queue that applies actions to an RTCPeerConnection in the most sensible order

Latest version **2.10.0** (published 2015-11-18) · Apache 2.0 license · 0 weekly downloads

## Install

```sh
npm install rtc-taskqueue
pnpm add rtc-taskqueue
yarn add rtc-taskqueue
bun add rtc-taskqueue
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.10.0 |
| Published | 2015-11-18 |
| First published | 2014-08-18 |
| Weekly downloads | 0 |
| License | Apache 2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Damon Oehlman |
| Maintainers | damonoehlman, nathanoehlman |
| Keywords | webrtc, rtc.io, RTCPeerConnection |

## Links

- npm: https://www.npmjs.com/package/rtc-taskqueue
- Repository: https://github.com/rtc-io/rtc-taskqueue
- Issues: https://github.com/rtc-io/rtc-taskqueue/issues
- npm.io page: https://npm.io/package/rtc-taskqueue

## Dependencies (8)

- [mbus](https://npm.io/package/mbus.md) ^2.0.0
- [whisk](https://npm.io/package/whisk.md) ^1.1.0
- [rtc-sdp](https://npm.io/package/rtc-sdp.md) ^1.2.0
- [rtc-core](https://npm.io/package/rtc-core.md) ^4.0.0
- [es6-promise](https://npm.io/package/es6-promise.md) ^3.0.2
- [rtc-sdpclean](https://npm.io/package/rtc-sdpclean.md) ^1.0.0
- [rtc-validator](https://npm.io/package/rtc-validator.md) ^1.0.0
- [priorityqueuejs](https://npm.io/package/priorityqueuejs.md) ^1.0.0

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 2.10.0 (latest) — 2015-11-18
- 2.9.0 — 2015-11-16
- 2.8.1 — 2015-10-28
- 2.8.0 — 2015-09-22
- 2.7.0 — 2015-08-02
- 2.6.4 — 2015-06-10
- 2.6.3 — 2015-06-09
- 2.6.2 — 2015-06-09
- 2.6.1 — 2015-06-02
- 2.6.0 — 2015-05-15
- 2.5.2 — 2015-03-26
- 2.5.1 — 2015-03-18
- 2.5.0 — 2015-03-12
- 2.4.6 — 2015-03-01
- 2.4.5 — 2015-03-01
- … 20 more at https://npm.io/package/rtc-taskqueue/versions

## README

# rtc-taskqueue

This is a package that assists with applying actions to an `RTCPeerConnection`
in as reliable order as possible. It is primarily used by the coupling logic
of the [`rtc-tools`](https://github.com/rtc-io/rtc-tools).


[![NPM](https://nodei.co/npm/rtc-taskqueue.png)](https://nodei.co/npm/rtc-taskqueue/)

[![Build Status](https://img.shields.io/travis/rtc-io/rtc-taskqueue.svg?branch=master)](https://travis-ci.org/rtc-io/rtc-taskqueue) [![unstable](https://img.shields.io/badge/stability-unstable-yellowgreen.svg)](https://github.com/dominictarr/stability#unstable) 

## Example Usage

For the moment, refer to the simple coupling test as an example of how to use
this package (see below):

```js
var test = require('tape');
var taskqueue = require('rtc-taskqueue');
var RTCPeerConnection = require('rtc-core/detect')('RTCPeerConnection');
var waitConnected = require('rtc-core/wait-connected');
var connections = [];
var queues = [];
var offerSdp;
var answerSdp;

// require('cog/logger').enable('*');

test('can create connection:0', function(t) {
  t.plan(1);
  t.ok(connections[0] = new RTCPeerConnection({ iceServers: [] }));
});

test('can create connection:1', function(t) {
  t.plan(1);
  t.ok(connections[1] = new RTCPeerConnection({ iceServers: [] }));
});

test('can wrap the connections in queues', function(t) {
  t.plan(2);
  queues = connections.map(function(conn) {
    return taskqueue(conn, {
      sdpfilter: function(sdp) {
        return sdp;
      }
    });
  });

  t.ok(queues[0]);
  t.ok(queues[1]);
});

test('connect icecandidate event listeners so candidates are exchanged', function(t) {
  t.plan(1);
  connections[0].onicecandidate = queues[1].addIceCandidate;
  connections[1].onicecandidate = queues[0].addIceCandidate;
  t.pass('applied');
});

test('create a datachannel on connection:0 (required by moz)', function(t) {
  t.plan(1);
  connections[0].createDataChannel('test');
  t.pass('created data channel');
});

test('can create an offer using queue:0', function(t) {
  t.plan(1);
  queues[0].once('sdp.local', function(sdp) {
    t.ok(sdp, 'got sdp');
    offerSdp = sdp;
  });

  queues[0].createOffer();
});

test('can setRemoteDescription on connection:1', function(t) {
  t.plan(1);
  queues[1].once('sdp.local', function(sdp) {
    answerSdp = sdp;
    t.ok(sdp, 'got sdp');
  });

  queues[1].setRemoteDescription(offerSdp);
});

test('can setRemoteDescription on connection:0', function(t) {
  t.plan(2);
  waitConnected(connections[0], t.pass.bind(t, 'connection:0 connected'));
  waitConnected(connections[1], t.pass.bind(t, 'connection:1 connected'));

  queues[0].setRemoteDescription(answerSdp);
});

```

## License(s)

### Apache 2.0

Copyright 2015 National ICT Australia Limited (NICTA)

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

---
_Source: https://npm.io/package/rtc-taskqueue · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
