Skip to content

Client for node.js applications that help to use push-service

License

Notifications You must be signed in to change notification settings

theappshop/push-service-client

Repository files navigation

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

About

Client for node.js applications that help to use push-service

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published