Guest User

Untitled

a guest
Mar 19th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. const Expo = require('expo-server-sdk')
  2. const expo = new Expo()
  3.  
  4. async function send(messages) {
  5. const chunks = expo.chunkPushNotifications(messages)
  6. for (const chunk of chunks) {
  7. try {
  8. const receipts = await expo.sendPushNotificationsAsync(chunk)
  9. receipts.forEach(receipt => {
  10. if (receipt.status === 'error') {
  11. throw new Error(receipt.message)
  12. }
  13. })
  14. } catch (error) { ... }
  15. }
  16. }
Add Comment
Please, Sign In to add comment