Skip to main content

Getting started with HTTP

This guide will introduce deepstream'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.

Start the server

Let's start by installing the server. Just pick the right version for your operating system and follow its steps. Once the server is installed, you can start it with:

deepstream start

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>';

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"

For more information see deepstream HTTP docs.