
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
pusher-platform-node
Advanced tools
Pusher Platform SDK for Node.js.
Add pusher-platform
to your package.json file:
{
"dependencies": {
"pusher-platform": "^0.2.0"
}
}
In order to access Pusher Platform, first instantiate an App object:
var pusher = require("pusher-platform");
var app = new pusher.App({
cluster: "",
app_id: "",
app_key: "",
});
App objects provide an authenticate
method, which can be used in controllers
to build authentication endpoints. Authentication endpoints issue access tokens
used by Pusher Platform clients to access the API.
Make sure you authenticate the user before issuing access tokens.
let authOptions = {
userId: 'zan',
serviceClaims: {
claim1: 'sdsdsd'
...
}
}
let authResponse = app.authenticate(req, {
userId: 'r00t',
serviceClaims: {
name: 'zan',
admin: true
}
});
Where the authResponse is an object containing your access and refresh tokens:
let = authResponse: {
access_token: {
token: 'adsasd',
expires_id: 1000
},
token_type: 'bearer';
expires_in: 20000;
refresh_token: 'cvbccvbb'
}
App objects provide a low-level request API, which can be used to contact Pusher Platform.
pusherApp.request({
method: "POST",
path: "feeds/playground",
headers: {
"Content-Type": "application/json",
},
body: pusher.writeJSON({ items: ["test"] }),
}).then(function(response) {
console.log(response.statusCode);
console.log(response.headers);
return pusher.readJSON(response);
}).then(function(body) {
console.log(body);
}).catch(function(e) {
if (e instanceof pusher.ErrorResponse) {
console.log(e.statusCode);
console.log(e.headers);
console.log(e.description);
} else {
console.log(e);
}
});
FAQs
Pusher Platform Node.js SDK
The npm package pusher-platform-node receives a total of 164 weekly downloads. As such, pusher-platform-node popularity was classified as not popular.
We found that pusher-platform-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.