Skip to content

Commit

Permalink
fixed linting, more transport info in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fed135 committed Jan 31, 2020
1 parent 7232ab6 commit 7240230
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
8 changes: 8 additions & 0 deletions packages/kalm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ To see working implementations, check out our [examples](https://github.com/kalm
[[Read more]](https://github.com/kalm/kalm.js/wiki/How-it-works)

- Transports [[wiki]](https://github.com/kalm/kalm.js/wiki/Transports)
- [@kalm/ipc](https://www.npmjs.com/package/@kalm/ipc)
- [@kalm/tcp](https://www.npmjs.com/package/@kalm/tcp)
- [@kalm/udp](https://www.npmjs.com/package/@kalm/udp)
- [@kalm/webrtc](https://www.npmjs.com/package/@kalm/webrtc)
- [@kalm/ws](https://www.npmjs.com/package/@kalm/ws)
- Routines [[wiki]](https://github.com/kalm/kalm.js/wiki/Routines)
- realtime
- dynamic
- tick

## Logging

Expand Down
20 changes: 10 additions & 10 deletions packages/webrtc/src/webrtc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ function webrtc(config: WebRTCConfig = {}): KalmTransport {
return node;
}

function bind(): void {
activeNode = createNode(true);
passiveNode = createNode(false);
activeNode.on('signal', signal => {
if (signal.type === 'offer') emitter.emit('ready', signal);
});

if (config.peers) config.peers.forEach(peer => negociate({ peer }));
}

function negociate(event: any) {
return new Promise(resolve => {
if (!event.peer) throw new Error('No peer configuration provided in `connect`.');
Expand All @@ -43,6 +33,16 @@ function webrtc(config: WebRTCConfig = {}): KalmTransport {
});
}

function bind(): void {
activeNode = createNode(true);
passiveNode = createNode(false);
activeNode.on('signal', signal => {
if (signal.type === 'offer') emitter.emit('ready', signal);
});

if (config.peers) config.peers.forEach(peer => negociate({ peer }));
}

function send(handle: any, payload: number[]): void {
handle.send(Buffer.from(payload));
}
Expand Down

0 comments on commit 7240230

Please sign in to comment.