Skip to content

Instantly share code, notes, and snippets.

@ShMcK
Created March 10, 2018 20:34
Show Gist options
  • Save ShMcK/d2daf40d3f2fdb3b92f8d6524cdcafc2 to your computer and use it in GitHub Desktop.
Save ShMcK/d2daf40d3f2fdb3b92f8d6524cdcafc2 to your computer and use it in GitHub Desktop.
simple expo message server demo
const Expo = require('expo-server-sdk')
const expo = new Expo()
async function send(messages) {
const chunks = expo.chunkPushNotifications(messages)
for (const chunk of chunks) {
try {
const receipts = await expo.sendPushNotificationsAsync(chunk)
receipts.forEach(receipt => {
if (receipt.status === 'error') {
throw new Error(receipt.message)
}
})
} catch (error) { ... }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment