1.0.10 • Published 2 years ago

webpubsub-js v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Webpubsub JavaScript SDK (V4)

Build Status Codacy Badge npm Bower Known Vulnerabilities

This is the official Webpubsub JavaScript SDK repository.

Webpubsub takes care of the infrastructure and APIs needed for the realtime communication layer of your application. Work on your app's logic and let Webpubsub handle sending and receiving data across the world in less than 100ms.

Get keys

You will need the publish and subscribe keys to authenticate your app. Get your keys from the Admin Portal.

Configure Webpubsub

  1. Integrate the JavaScript SDK into your project:

  2. Configure your keys:

    webpubsub = new Webpubsub({
      publishKey : "myPublishKey",
      subscribeKey : "mySubscribeKey",
      uuid: "myUniqueUUID"
    })

Add event listeners

webpubsub.addListener({
  message: function (m) {
    // handle messages
  },
  presence: function (p) {
    // handle presence  
  },
  signal: function (s) {
    // handle signals
  },
  objects: (objectEvent) => {
    // handle objects
  },
  messageAction: function (ma) {
    // handle message actions
  },
  file: function (event) {
    // handle files  
  },
  status: function (s) {
  // handle status  
  },
});

Publish/subscribe

var publishPayload = {
    channel : "hello_world",
    message: {
        title: "greeting",
        description: "This is my first message!"
    }
}

webpubsub.publish(publishPayload, function(status, response) {
    console.log(status, response);
})

webpubsub.subscribe({
    channels: ["hello_world"]
});

Documentation

Support

If you need help or have a general question, contact support@webpubsub.com.

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

7.1.1-beta

2 years ago