Reputation: 319
I was wondering if I can set rethinkdb changefeeds in deepstream io and subscribe to this from frontent for each and every client . I do not want to use rethinkdb as deepstream storage .
Here is the scenario what i want to achieve .
I already have a rethink db table where i insert/update/delete data and which is configured in a node js server .
I have a simple index.html file in front end where i get / post to the node server to update rethink db
I get the change feeds in node server . {up to that these all are running }
Now i want to set the changefeeds from back end and subscribe it to the frontend . {How to achieve it?}
Any kind of help will be appreciated .
Upvotes: 0
Views: 156
Reputation: 363
If you're wanting to subscribe to changes with your clients, the updates will need to go through the deepstream server. You'll need to use rethinkdb as the deepstream storage layer.
We have an excellent tutorial here[1] that will show you how to set up realtime change feeds, which sounds like exactly what you're looking for.
It's also not hard to proxy your writes to rethinkdb through a deepstream client[2] to get what you're looking for, ie:
const deepstream = require('deepstream.io-client-js')
const client = deepstream('<Your deepstream URL>')
client.login({ token: 'your-admin-token' })
// instead of inserting via the rethinkdb module
client.record.setData('your-record-name', data)
// or
const record = client.record.getRecord('your-record-name')
record.set(data)
[1] RethinkDB DataBase Connector
Upvotes: 0