why deepstreamHub? compare us getting started feature roadmap faq
use cases pricing
products
developers
company
blog contact

Getting started with deepstreamHub is easy and takes less than ten minutes. However, if you have any questions, please get in touch.

This guide will introduce deepstreamHub's HTTP interface, and show how it can be used to access Records, Events, RPCs and Presence.

The first thing you'll need to access the HTTP API is your application's unique HTTP URL.

Create a free account and get your API key

To see how it works in real-time we can set up a javascript WebSocket client. To get that setup, take a look at the getting started with javascript tutorial.

Events (publish-subscribe)

We'll use the JS client to subscribe to the event 'test-event':

ds.event.subscribe( 'test-event', function( eventData ){ 
  console.log( eventData );
});

... and now we can publish events using an HTTP client, such as jQuery.ajax:

const requestBody = {
  body: [{
    topic: 'event',
    action: 'emit',
    eventName: 'test-event',
    data: { some: 'data' }
  }]
};

const url = '<YOUR HTTP URL>';

$.ajax({
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  url: url,
  data: JSON.stringify(requestBody)
}).done(function (response) {
  console.log('The request was a', response.result);
});

... or cURL:

curl -X POST -H "Content-Type: application/json" -d '{
  "body": [{
    "topic": "event",
    "action": "emit",
    "eventName": "test-event",
    "data": "some test data"
  }]
}' "<YOUR HTTP URL>"

For more information see deepstreamHub HTTP docs.