twinkie
twinkie

Reputation: 31

serverside subscribe to model in sails

in my favorite scenario, I have mutliple dynamic nodes running a identical sails.js app. The nodes need to send messages each other. I try to archieve this through a redis db with a node model. Each server subscribes to all models and creates one for himself. This could be done easily on a client with sails.io.js.

But how can I subscribe and register callback functions to model rooms at server code? These nodes cannot communicate through tcp, because they are living in a isolated docker environment. Any thoughts would be greatly appreciated!

Upvotes: 0

Views: 45

Answers (1)

DarkLeafyGreen
DarkLeafyGreen

Reputation: 70426

Put your nodes on the same docker network to allow them to discover each other. If you not familiar with docker networks yet, I recommend to read Understand Docker container networks, it's an awesome tool.

This could be done easily on a client with sails.io.js.

It is totally possible. You have to use the socket.io.js client on the server: https://github.com/balderdashy/sails.io.js

For server to server communication I prefer Publish/Subscribe messaging tools like redis PupSub http://redis.io/topics/pubsub or https://www.rabbitmq.com/

Upvotes: 1

Related Questions