Search code examples
deepstream.io

deepstream is it possible to publish from my server, without opening a client connection in a browser


I am somewhat confused in deepstream, is it possible to communicate to a client from my server? For example, is there any way to do something like this on a server? I am currently opening a client connection in browser that publishes to other clients. I would rather have the code below in my server.

var client = deepstream('localhost:6020').login()
var record = client.record.getRecord('new-record')

#Publish a message to all listeners of 'listen-channel' from my server?
record.set('listen-channel', 'message');

and then have clients listen:

record.subscribe('listen-channel', function(value) {
        console.log(value);

Solution

  • Sure, just run it from a node process. Deepstream "clients" can be backend and frontend processes alike, permissioning is used to distuinguish between who can do what.

    enter image description here