How to use the y-protocols/awareness.js.Awareness function in y-protocols

To help you get started, we’ve selected a few y-protocols examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yjs / y-webrtc / src / y-webrtc.js View on Github external
constructor (
    roomName,
    doc,
    {
      signaling = ['wss://signaling.yjs.dev', 'wss://y-webrtc-uchplqjsol.now.sh', 'wss://y-webrtc-signaling-eu.herokuapp.com', 'wss://y-webrtc-signaling-us.herokuapp.com'],
      password = null,
      awareness = new awarenessProtocol.Awareness(doc)
    } = {}
  ) {
    super()
    this.roomName = roomName
    this.doc = doc
    /**
     * @type {awarenessProtocol.Awareness}
     */
    this.awareness = awareness
    this.shouldConnect = false
    this.signalingUrls = signaling
    this.signalingConns = []
    /**
     * @type {PromiseLike}
     */
    this.key = password ? cryptoutils.deriveKey(password, roomName) : /** @type {PromiseLike} */ (promise.resolve(null))