| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This is the official PubNub JavaScript SDK repository.
PubNub takes care of the infrastructure and APIs needed for the realtime communication layer of your application. Work on your app's logic and let PubNub handle sending and receiving data across the world in less than 100ms.
You will need the publish and subscribe keys to authenticate your app. Get your keys from the Admin Portal.
Integrate the JavaScript SDK into your project:
npm install pubnub
Configure your keys:
pubnub = new PubNub({
publishKey : "myPublishKey",
subscribeKey : "mySubscribeKey",
uuid: "myUniqueUUID"
})pubnub.addListener({
message: function (m) {
// handle messages
},
presence: function (p) {
// handle presence
},
signal: function (s) {
// handle signals
},
objects: (objectEvent) => {
// handle pbjects
},
messageAction: function (ma) {
// handle message actions
},
file: function (event) {
// handle files
},
status: function (s) {
// handle status
},
});var publishPayload = {
channel : "hello_world",
message: {
title: "greeting",
description: "This is my first message!"
}
}
pubnub.publish(publishPayload, function(status, response) {
console.log(status, response);
})
pubnub.subscribe({
channels: ["hello_world"]
});If you need help or have a general question, contact support@pubnub.com.
| Back | FazBrowse Home | New Git URL |