@appdevshop/push-service-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Install

npm i --save @appdevshop/push-service-client

Usage

Import package

import pushService from '@appdevshop/push-service-client'

Initialize client with information about where push-service is running.
After that you can use your pushService everywhere.

pushService.initialize({ host: 'localhost', port: 1343 }) 

Available commands:

You can register firebase token and connect it to some user.

pushService.register(userToken, firebaseToken)

You can unregister firebase token from some user.

pushService.unregister(userToken, firebaseToken)

You can send message to some user, using userToken that was use while registering.

pushService.send(userToken, {
    title: 'push title',
    body: 'push text',
    payload: {
        field: 'all addditional info'
    }
})

userToken - some user identificator, string
firebaseToken - firebase token that was send by user and generated by firebase

Or you can create multiple clients for each service:

const client1 = pushService.createClient({ host: 'localhost', port: 8081 })
const client2 = pushService.createClient({ host: 'localhost', port: 8082 })

Links

NPM
Push-service

Package Sidebar

Install

npm i @appdevshop/push-service-client

Weekly Downloads

10

Version

1.0.2

License

MIT

Unpacked Size

6.65 kB

Total Files

5

Last publish

Collaborators

  • astepano