JSPM

  • Created
  • Published
  • Downloads 2573786
  • Score
    100M100P100Q207484F
  • License MIT

Listen to realtime updates to your PostgreSQL database

Package Exports

  • @supabase/realtime-js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@supabase/realtime-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Realtime Client

Listens to changes in a PostgreSQL Database and broadcasts them over websockets.

Usage

This is for usage with Supabase Realtime server.

Basic usage:

import { Socket } = '@supabase/realtime-js'

var socket = new Socket(process.env.REALTIME_URL)
socket.connect()

// Listen to only INSERTS on the 'users' table in the 'public' schema
var allChanges = this.socket.channel('realtime:public:users')
  .join()
  .on('INSERT', payload => { console.log('Update received!', payload) })

// Listen to all changes from the 'public' schema
var allChanges = this.socket.channel('realtime:public')
  .join()
  .on('*', payload => { console.log('Update received!', payload) })

// Listen to all changes in the database
let allChanges = this.socket.channel('realtime:*')
  .join()
  .on('*', payload => { console.log('Update received!', payload) })

See full instructions this repository: Supabase Realtime.

Credits

  • Basic Node.js client was made by Mario Campa of phoenix-channels.
  • API was made by authors of the Phoenix Framework. See their website for complete list of authors.

License

MIT. License is the same as phoenix-channels and Phoenix Framework.