Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
pusher-platform-node
Advanced tools
Pusher Platform SDK for Node.js.
Add pusher-platform-node
to your package.json file:
{
"dependencies": {
"pusher-platform-node": "^0.5.0"
}
}
In order to access Pusher Platform, first instantiate an Instance object. It takes the following arguments:
var pusher = require("pusher-platform-node");
var pusherPlatform = new pusher.Instance({
instance: "",
serviceName: "",
serviceVersion: "",
key: "",
});
instance
is the ID that is unique to app developers' instance - they get that from the dashboard. The service SDKs will need to relay that down. Same for the key
.
serviceName
and serviceVersion
should come from the service SDK itself. They can be hardcoded there. Think feeds
and v1
.
It is also possible to specify host
and port
. This will override the cluster value that is encoded in the instance
and allow you to connect to a development or testing server.
Instance 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.
authenticatePayload
param is essentially object of type AuthenticatePayload
. The object must have the following format: (Please note that if you using one of our client libraries they will handle this format for you)type AuthenticatePayload {
grant_type?: string;
refresh_token?: string;
};
let authenticatePayload = {
grant_type: 'client_credentials'
};
let authOptions = {
userId: 'zan',
serviceClaims: {
claim1: 'sdsdsd'
...
}
};
let authResponse = app.authenticate(authenticatePayload, authOptions);
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'
}
Instance 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 279 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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.