# peer-connection-shim

> Emulating peer connection in node & browser

Latest version **0.7.2** (published 2012-12-12) · 0 weekly downloads

## Install

```sh
npm install peer-connection-shim
pnpm add peer-connection-shim
yarn add peer-connection-shim
bun add peer-connection-shim
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.2 |
| Published | 2012-12-12 |
| First published | 2012-11-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Raynos |
| Maintainers | raynos |
| Keywords | webrtc, p2p, peer, real-time, realtime, real, time, peer2peer |

## Links

- npm: https://www.npmjs.com/package/peer-connection-shim
- Repository: https://github.com/Raynos/peer-connection-shim
- Issues: https://github.com/Raynos/peer-connection-shim/issues
- npm.io page: https://npm.io/package/peer-connection-shim

## Dependencies (5)

- [mux-demux](https://npm.io/package/mux-demux.md) ~3.3.6
- [node-uuid](https://npm.io/package/node-uuid.md) ~1.4.0
- [pause-stream](https://npm.io/package/pause-stream.md) 0.0.6
- [write-stream](https://npm.io/package/write-stream.md) ~0.4.3
- [header-stream](https://npm.io/package/header-stream.md) ~0.1.4

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 0.7.2 (latest) — 2012-12-12
- 0.7.1 — 2012-12-12
- 0.7.0 — 2012-11-21
- 0.6.0 — 2012-11-21
- 0.5.0 — 2012-11-20
- 0.4.1 — 2012-11-20
- 0.4.0 — 2012-11-20
- 0.3.1 — 2012-11-18
- 0.3.0 — 2012-11-18
- 0.2.0 — 2012-11-16
- 0.1.1 — 2012-11-15
- 0.1.0 — 2012-11-15

## README

# peer-connection-shim

Emulating peer connection in node & browser

## Example

Works on either server or client.

```js
var PeerConnection = require("peer-connection")
    , WriteStream = require("write-stream")
    , SignalChannel = require("signal-channel")

    , RTCPeerConnection = require("peer-connection-shim")

var pc1 = PeerConnection(RTCPeerConnection({
    stream: SignalChannel(null, "/v1/relay")
}))

var pc2 = PeerConnection(RTCPeerConnection({
    stream: SignalChannel(null, "/v1/relay")
}))

pc1.createOffer(function (err, offer) {
    pc2.createAnswer(offer, function (err, answer) {
        pc1.setRemote(answer)

        open()
    })
})

pc1.on("connection", function (stream) {
    console.log("open channel", stream.meta)

    stream.pipe(WriteStream(function (chunk) {
        console.log("pc1", chunk)

        stream.write(chunk)
    }))
})

function open() {
    var stream = pc2.createStream("channel name")

    stream.write("hello world!")

    stream.pipe(WriteStream(function (chunk) {
        console.log("pc2", chunk)
    }))
}

```

## Installation

`npm install peer-connection-shim`

## Contributors

 - Raynos

## MIT Licenced

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