# socket.io-bridge-client

> Real-time bidirectional event-based communication between two socket.io clients

Latest version **1.0.0** (published 2020-03-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install socket.io-bridge-client
pnpm add socket.io-bridge-client
yarn add socket.io-bridge-client
bun add socket.io-bridge-client
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-03-21 |
| First published | 2018-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 32.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Michael Karl Franzl |
| Maintainers | michaelfranzl |
| Keywords | socket.io, socketio, events, client-client |

## Links

- npm: https://www.npmjs.com/package/socket.io-bridge-client
- Repository: https://github.com/michaelfranzl/socket.io-bridge
- Homepage: https://github.com/michaelfranzl/socket.io-bridge#readme
- Issues: https://github.com/michaelfranzl/socket.io-bridge/issues
- npm.io page: https://npm.io/package/socket.io-bridge-client

## Dependencies (2)

- [uuid-random](https://npm.io/package/uuid-random.md) ^1.3.0
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^2.3.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-03-21
- 0.1.5 — 2018-02-21
- 0.1.4 — 2018-02-10
- 0.1.3 — 2018-02-09
- 0.1.2 — 2018-02-09

## README

# socket.io-bridge-client

Client implementation for socket.io-bridge.

Please find the project documentation at https://github.com/michaelfranzl/socket.io-bridge .

# API Reference

## Classes

<dl>
<dt><a href="#BridgeClient">BridgeClient</a></dt>
<dd></dd>
</dl>

## Typedefs

<dl>
<dt><a href="#Socket">Socket</a></dt>
<dd></dd>
</dl>

<a name="BridgeClient"></a>

## BridgeClient
**Kind**: global class  

* [BridgeClient](#BridgeClient)
    * [new BridgeClient(opts)](#new_BridgeClient_new)
    * _static_
        * [.make(opts)](#BridgeClient.make) ⇒ <code>Promise</code>
    * _inner_
        * [~onconnection](#BridgeClient..onconnection) : <code>function</code>

<a name="new_BridgeClient_new"></a>

### new BridgeClient(opts)

| Param | Type |
| --- | --- |
| opts | <code>Object</code> | 
| opts.socket | [<code>Socket</code>](#Socket) | 

<a name="BridgeClient.make"></a>

### BridgeClient.make(opts) ⇒ <code>Promise</code>
Make a Socket.IO bridge to another client.

**Kind**: static method of [<code>BridgeClient</code>](#BridgeClient)  
**Returns**: <code>Promise</code> - - Promise resolving with a Socket.IO client socket connecting to the
requested peer/client. The Promise can be used only for a single connection, e.g. when `peerUid`
is set and there will be no incoming connections.  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| opts | <code>Object</code> |  |  |
| [opts.uid] | <code>string</code> | <code>&quot;globally unique&quot;</code> | Our ID. |
| [opts.peerUid] | <code>string</code> |  | The ID of the peer we want to establish a connection to. |
| [opts.onconnection] | [<code>onconnection</code>](#BridgeClient..onconnection) |  | Called for each incoming connection. |
| [opts.logger] | <code>object</code> |  | No logging by default |

<a name="BridgeClient..onconnection"></a>

### BridgeClient~onconnection : <code>function</code>
Called as soon as the peer identified by peerUid is available for a connection.

**Kind**: inner typedef of [<code>BridgeClient</code>](#BridgeClient)  

| Param | Type | Description |
| --- | --- | --- |
| socket | [<code>Socket</code>](#Socket) | Socket.IO client socket connecting to the requested peer/client. |

<a name="Socket"></a>

## Socket
**Kind**: global typedef  
**See**: [https://github.com/socketio/socket.io-client/blob/master/docs/API.md#socket](https://github.com/socketio/socket.io-client/blob/master/docs/API.md#socket)

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