How to use the phoenix.Presence.syncDiff function in phoenix

To help you get started, we’ve selected a few phoenix 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 akshaykmr / oorja / app / imports / ui / components / Room / index.js View on Github external
const handlePresenceDiff = (diff) => {
      console.log('presence_diff', diff);
      const oldPresence = this.stateBuffer.presence;
      const syncedPresence = Presence.syncDiff(oldPresence, diff);
      this.updateState({ presence: { $set: syncedPresence } });

      const handleJoins = joins => Object.keys(joins).forEach(this.handleJoin);
      const handleLeaves = leaves => Object.keys(leaves).forEach(this.handleLeave);
      handleJoins(diff.joins);
      handleLeaves(diff.leaves);
    };
github rsilvestre / phoenix-react-redux-starter-kit / web / static / js / modules / session.js View on Github external
interfaceChannel.on('presence_diff', diff => {
            presences = Presence.syncDiff(presences, diff)
            dispatch(updatePresences(Presence.list(presences, listBy)))
          })
github stride-nyc / remote_retro / web / static / js / components / remote_retro.js View on Github external
room.on("presence_diff", diff => {
      presences = Presence.syncDiff(presences, diff)
      const users = values(presences).map(presence => presence.user)
      this.setState({ users })
    })
github bnhansn / sling / web / src / actions / room.js View on Github external
channel.on('presence_diff', (diff) => {
      presences = Presence.syncDiff(presences, diff);
      syncPresentUsers(dispatch, presences);
    });
github danieldocki / slack-clone-vuejs-elixir-phoenix / web / src / store / plugins.js View on Github external
channel.on('presence_diff', (diff) => {
            presences = Presence.syncDiff(presences, diff)
            store.dispatch('syncPresentUsers', presences)
          })
github kenforthewin / mentat / assets / js / components / App.js View on Github external
this.channel.on("presence_diff", diff => {
      this.setState({
        ...this.state,
        presences: Presence.syncDiff(this.state.presences, diff)
      });
    });