# actually-serverless

> Connecting peers using torrent technologies.

Latest version **0.1.2** (published 2020-01-06) · 0 weekly downloads

## Install

```sh
npm install actually-serverless
pnpm add actually-serverless
yarn add actually-serverless
bun add actually-serverless
```

## 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.1.2 |
| Published | 2020-01-06 |
| First published | 2017-11-05 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 140.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ericwooley |

## Links

- npm: https://www.npmjs.com/package/actually-serverless
- Homepage: http://ericwooley.github.io/actually-serverless
- npm.io page: https://npm.io/package/actually-serverless

## Dependencies (3)

- [sha1](https://npm.io/package/sha1.md) ^1.1.1
- [webtorrent](https://npm.io/package/webtorrent.md) ^0.107.17
- [simple-peer](https://npm.io/package/simple-peer.md) ^9.6.2

## Recent versions

- 0.1.2 (latest) — 2020-01-06
- 0.1.1 — 2019-12-21
- 0.1.0 — 2017-11-05

## README

# Actually serverless
Connecting peers using torrent technologies.

## Install

Easily create serverless web rtc connections based on a connection string.

`npm install --save actually-serverless`

or yarn

`yarn add actually-serverless`

## usage

Here is a very basic usage. 

```js
import actuallyServerless from "actually-serverless"
let peers = []
const stopLookingForPeers = actuallyServerless({
    connectionString: "Any string you want to use to discover peers.",
    // each peer is an extended version of https://github.com/feross/simple-peer
    // with onMessage and sendMessage added.
    onPeer: peer => {
        peers.push(peer)
        peer.on('close', () => {
            peers = peers.filter(p => p !== peer)
        })
        peer.onMessage((meesage) => {
            console.log('message from a peer: ', message)
        }))
        peer.sendMessage("welcome to my peer group, I know about " + peers.length + " peers")
    }
})

// to teardown
stopLookingForPeers()
peers.forEach(peer => peer.destroy())
```

Try out the [serverless chat room](https://ericwooley.github.io/actually-serverless/)! See the [source](./src/App.tsx) for more advanced usage.

See the [readme](./README-CRA.md) for create react app, if you want to play with the demo src.

## usage with webpack

Webtorrent is kind of a PITA with webpack. See:
https://github.com/webtorrent/webtorrent/issues/347

You will probably run into issues with minifying, what you end up needing to do is split webpack into it's own bundle and ignore that bundle for minificaiton.

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