@philschatz/cevitxe-signal-client
TypeScript icon, indicating that this package has built-in type declarations

0.5.4 • Public • Published

🐟 cevitxe-signal-client

A simple discovery cloud client library that can be paired with cevitxe-signal-server .

You don't strictly need to use this client - you could interact directly with the server the way we do in the server tests - but it automates the business of accepting invitations when they're received.

The client keeps track of all peers that the server connects you to, and for each peer it keeps track of each key (aka discoveryKey, aka channel) that you're working with that peer on.

The simplest workflow is something like this:

client = new Client({ id: 'my-peer-id', url })
client.join('my-document-id')
client.on('peer', (peer, key) => {
  const socket = peer.get(key) // `socket` is a WebSocket instance

  // send a message
  socket.send('Hello!')

  // listen for messages
  socket.onmessage = () => {
    console.log(messsage)
  }
})

Readme

Keywords

none

Package Sidebar

Install

npm i @philschatz/cevitxe-signal-client

Weekly Downloads

3

Version

0.5.4

License

MIT

Unpacked Size

937 kB

Total Files

30

Last publish

Collaborators

  • philschatz