deepstream.io is currently under reconstruction for the V4 release!

For V3 and enterprise documentation please go to https://deepstreamhub.com

To continue click here

NPM

Installing deepstream via NPM and and Node.js

Node.js

deepstream can also be installed as an NPM package and offers a Node.js API to interact with it programmatically.

This can be useful to build custom authentication or permissioning logic or if you want to use the server on top of a HTTP server like Express. You can view the full Node.js API here.

Install the server via npm

npm install @deepstream/server

Create a js file, e.g. start.js with the following content

const DeepstreamServer = require('@deepstream/server')
const C = DeepstreamServer.constants
/*
The server can take
1) a configuration file path
2) null to explicitly use defaults to be overriden by server.set()
3) left empty to load the base configuration from the config file located within the conf directory.
4) pass some options, missing options will be merged with the base configuration
*/
const server = new DeepstreamServer({
  host: 'localhost',
  port: 6020
})

// start the server
server.start()

run the file with node

node start.js

Using the deepstream client in Node.js

The deepstream javascript client can be installed via NPM and used in Node.js.

npm install @deepstream/client
const deepstream = require('@deepstream/client')
const client = deepstream('localhost:6020')
client.login()