npm.io
0.121.0 • Published 8 years ago

reflector-client

Licence
MIT
Version
0.121.0
Deps
3
Vulns
0
Weekly
0
Stars
6.3K

Low level client for the Reflector client to client messaging system

Implements the messaging protocol that supports the Sanity real time presence exprience.

Initializing

  import Reflector from '@sanity/reflector-client'
  import myConfiguredSanityClient from './myConfiguredSanityClient'

  channel = new Reflector(mySanityClient).connect('channelName')

Listening

  channel.listen().subscribe(msg => {
    console.log(msg) // => {i: <sanity-identity>, m: <message>}
  })

Sending

  channel.send({'hello': 'sanity!'})

Keywords