zetapush-js
TypeScript icon, indicating that this package has built-in type declarations

3.4.0 • Public • Published

NPM version Document Build Status

ZetaPush JavaScript SDK

Install

From npm

npm install zetapush-js --save

From yarn

yarn add zetapush-js
import { Client, Authentication, services } from 'zetapush-js'

From CDN (unpkg recommended)

<script src="//unpkg.com/zetapush-js/dist/zetapush.min.js"></script>
const { Client, Authentication, services } = ZetaPush

Usage

// Create new ZetaPush Client
const client = new Client({
  sandboxId: '<YOUR-SANDBOX-ID>',
  authentication() {
    return Authentication.weak({
      token: null
    })
  }
})
// Create a Stack service
const service = client.createService({
  Type: services.Stack,
  listener: {
    list(message) {
      console.log('list callback', message)
    }
  }
})
// Add connection listener
client.onConnectionEstablished(() => {
  // Call service methods
  service.list({
    stack: '<YOUR-STACK-ID>'
  })
})
// Connect client to ZetaPush BaaS
client.connect()

Any questions?

Package Sidebar

Install

npm i zetapush-js

Weekly Downloads

10

Version

3.4.0

License

MIT

Unpacked Size

1.2 MB

Total Files

71

Last publish

Collaborators

  • zetapush