Namespaces

ovok.push

Register the signed-in person's devices for push, and set up the provider the project's push goes through.

  • Stable unknown
  • Release candidate not available
  • Development not available

ovok.push has two halves. devices is the app's side: register the device a person signed in on, list their devices and remove one. provider holds the project's push provider and is for project admins. Providers are fcm, apns, expo and relay, which posts each push to an HTTPS endpoint of your own.

Register a device

const device = await ovok.push.devices.register({
  token: expoPushToken,
  platform: 'ios',
  appId: 'com.example.care',
});
  • Register after sign-in, and again whenever the token changes. Registering the same token again answers the same device.
  • The device belongs to the signed-in profile: a patient, practitioner or related person.
  • The token is never returned. list shows each device's id, platform, appId and registeredAt.

Remove a device

await ovok.push.devices.unregister(device.id);
  • Call it on sign-out, so the device gets no more push for that person.

Set up the provider

const { secret } = await ovok.push.provider.create({ provider: 'relay', url: 'https://push.example.com/ovok' });

await ovok.push.provider.update({ provider: 'apns', environment: 'production' });
await ovok.push.provider.remove();
  • create checks the credentials with the provider first. A relay's whsec_ signing secret is answered this once; store it where your relay verifies requests.
  • retrieve shows the provider and its settings, never a secret.
  • update names the provider set up. To switch providers, remove the old one and create the new one.
  • The calls go to v1/push/devices and v1/push/provider.

See also

Last updated on

On this page