How to use cozy-realtime - 3 common examples

To help you get started, we’ve selected a few cozy-realtime 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 cozy / cozy-bar / src / lib / realtime.js View on Github external
throw new Error(`Cannot fetch app ${app.slug}: ${error.message}`)
    }

    if (typeof onCreate === 'function') {
      onCreate(fullApp)
    }
  }

  const handleAppRemoval = app => {
    if (typeof onDelete === 'function') {
      onDelete(app)
    }
  }

  try {
    const realtime = new CozyRealtime({ client: cozyClient })
    realtime.subscribe('created', APPS_DOCTYPE, handleAppCreation)
    realtime.subscribe('deleted', APPS_DOCTYPE, handleAppRemoval)
  } catch (error) {
    // eslint-disable-next-line no-console
    console.warn(`Cannot initialize realtime in Cozy-bar: ${error.message}`)
  }
}
github cozy / cozy.github.io / en / cozy-banks / src / ducks / balance / Balance.jsx View on Github external
ensureRealtime() {
    if (this.realtime) {
      return
    }
    const client = this.props.client
    this.realtime = new CozyRealtime({ client })
  }
github cozy / cozy.github.io / en / cozy-banks / src / ducks / transfers / TransferPage.jsx View on Github external
followJob(job) {
    const rt = new Realtime({ client: this.props.client })
    this.unfollowJob = subscribe(
      rt,
      'updated',
      'io.cozy.jobs',
      job._id,
      this.handleJobChange
    )
  }

cozy-realtime

Realtime interactions with cozy-stack using Websocket

MIT
Latest version published 3 days ago

Package Health Score

73 / 100
Full package analysis

Popular cozy-realtime functions

Similar packages