Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expo-server-sdk

Package Overview
Dependencies
Maintainers
10
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-server-sdk - npm Package Compare versions

Comparing version 2.2.0 to 2.3.1

build/ExpoClient.js

22

package.json
{
"name": "expo-server-sdk",
"version": "2.2.0",
"version": "2.3.1",
"description": "Server side library for working with Expo using Node.js",
"main": "build/ExponentClient.js",
"main": "build/ExpoClient.js",
"files": [

@@ -14,2 +14,3 @@ "build"

"prepublish": "npm run build",
"test": "jest",
"watch": "babel src --out-dir build --ignore __tests__ --source-maps --watch"

@@ -25,3 +26,3 @@ },

"type": "git",
"url": "git+https://github.com/exponent/exponent-server-sdk-node.git"
"url": "git+https://github.com/expo/exponent-server-sdk-node.git"
},

@@ -33,8 +34,8 @@ "keywords": [

],
"author": "support@getexponent.com",
"author": "support@expo.io",
"license": "MIT",
"bugs": {
"url": "https://github.com/exponent/exponent-server-sdk-node/issues"
"url": "https://github.com/expo/exponent-server-sdk-node/issues"
},
"homepage": "https://github.com/exponent/exponent-server-sdk-node#readme",
"homepage": "https://github.com/expo/exponent-server-sdk-node#readme",
"dependencies": {

@@ -46,13 +47,12 @@ "babel-runtime": "^6.11.6",

"devDependencies": {
"babel-cli": "^6.14.0",
"babel-cli": "^6.24.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-es2016": "^6.11.3",
"babel-preset-es2017": "^6.14.0",
"babel-preset-stage-1": "^6.13.0",
"babel-preset-stage-2": "^6.13.0",
"jest": "^18.1.0"
"jest": "^20.0.0"
}
}

@@ -1,2 +0,2 @@

# exponent-server-sdk-node
# expo-server-sdk-node
Server side library for working with Exponent using Node.js

@@ -7,29 +7,50 @@

```bash
yarn add exponent-server-sdk
yarn add expo-server-sdk
```
```js
import Exponent from 'exponent-server-sdk';
import Expo from 'expo-server-sdk';
// To check if something is a push token
let isPushToken = Exponent.isExponentPushToken(somePushToken);
// Create a new Expo SDK client
let expo = new Expo();
// Create a new Exponent SDK client
let exponent = new Exponent();
// Create the messages that you want to send to clents
let messages = [];
for (let pushToken of somePushTokens) {
// Each push token looks like ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]
// To send push notifications -- note that there is a limit on the number of
// notifications you can send at once, use exponent.chunkPushNotifications()
(async function() {
try {
let receipts = await exponent.sendPushNotificationsAsync([{
// The push token for the app user to whom you want to send the notification
to: 'ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]',
sound: 'default',
body: 'This is a test notification',
data: {withSome: 'data'},
}]);
console.log(receipts);
} catch (error) {
console.error(error);
// Check that all your push tokens appear to be valid Expo push tokens
if (!Expo.isExpoPushToken(pushToken)) {
console.error(`Push token ${pushToken} is not a valid Expo push token`);
continue;
}
// Construct a message (see https://docs.expo.io/versions/latest/guides/push-notifications.html)
messages.push({
to: pushToken,
sound: 'default',
body: 'This is a test notification',
data: { withSome: 'data' },
})
}
// The Expo push notification service accepts batches of notifications so
// that you don't need to send 1000 requests to send 1000 notifications. We
// recommend you batch your notifications to reduce the number of requests
// and to compress them (notifications with similar content will get
// compressed).
let chunks = expo.chunkPushNotifications(messages);
(async () => {
// Send the chunks to the Expo push notification service. There are
// different strategies you could use. A simple one is to send one chunk at a
// time, which nicely spreads the load out over time:
for (let chunk of chunks) {
try {
let receipts = await expo.sendPushNotificationsAsync(chunk);
console.log(receipts);
} catch (error) {
console.error(error);
}
}
})();

@@ -52,3 +73,3 @@ ```

* https://github.com/exponent/exponent-server-sdk-ruby
* https://github.com/exponent/exponent-server-sdk-python
* https://github.com/exponent/expo-server-sdk-ruby
* https://github.com/exponent/expo-server-sdk-python
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc