README
Aries Framework JavaScript Push Notifications Plugin
Push Notifications plugin for Aries Framework JavaScript.
Installation
Make sure you have set up the correct version of Aries Framework JavaScript according to the AFJ repository. To find out which version of AFJ you need to have installed you can run the following command. This will list the required peer dependency for @aries-framework/core
.
npm info "@aries-framework/push-notifications" peerDependencies
Then add the push-notifications plugin to your project.
yarn add @aries-framework/push-notifications
Quick start
In order for this plugin to work we have to inject it into the agent to access agent functionality. See the example for more information
Example of usage
This is the current way however this will be changed someday to improve plugin management
import { PushNotificationsModule } from '@aries-framework/push-notifications'
const agent = new Agent(/** agent config... */)
const pushNotificationsModule = agent.injectionContainer.resolve(PushNotificationsModule)
await agent.initialize()
// To send native device info to another agent you have to accquire the device token and vendor yourself.
pushNotificationsModule.sendNativeDeviceInfo(
{ deviceToken: '123', deviceVendor: DeviceVendor.android },
'a-valid-connection-id'
)
// To get the device info and the used service back from the other agent
pushNotificationsModule.getNativeDeviceInfo('a-valid-connection')