publish-subscribe

Google Pub/Sub sending to only one subscription every ~5 messages

无人久伴 提交于 2020-01-06 06:01:11
问题 I've made 3 clients connected to a subscription, and one publisher. In the image 2 of the subscriptions are on the terminal, and one subscription is not seen as it is hosted on a DigitalOcean Droplet. It seems every 5 messages, it switches which subscriber actually receives the message, which should not happen. I've also varied the speed and it's always about 5 messages. Here is the code used on all clients for subscriptions: sub.on("message", (msg) => { console.log(`Message:1 ${msg.data

Google Pub/Sub sending to only one subscription every ~5 messages

你。 提交于 2020-01-06 06:00:13
问题 I've made 3 clients connected to a subscription, and one publisher. In the image 2 of the subscriptions are on the terminal, and one subscription is not seen as it is hosted on a DigitalOcean Droplet. It seems every 5 messages, it switches which subscriber actually receives the message, which should not happen. I've also varied the speed and it's always about 5 messages. Here is the code used on all clients for subscriptions: sub.on("message", (msg) => { console.log(`Message:1 ${msg.data

rspec: How to test redis#subscribe code?

夙愿已清 提交于 2020-01-05 03:00:10
问题 Given something like: class MyClass def subscribe $redis.subscribe('channel') do |on| on.message do |channel, msg| Something.create(msg) end end end end How can I test that when MyClass executes subscribe , it will run Something.create for each message it receives on the channel? 回答1: This code you have, it's not very testable. First of all, absolutely get rid of this global $redis variable. Instead, accept an instance of redis in the constructor. class MyClass attr_reader :redis def

Sails js subscribe to model changes scoped by groupid attribute

荒凉一梦 提交于 2020-01-04 12:45:34
问题 I have a model named Groupfeed which looks like this module.exports = { schema:true, attributes: { groupid: { model:'groups', required:true }, postid: { model:'post', required:true }, objectid: { model:'objects', required:true }, } }; On the client side I can subscribe to the Groupfeed model using io.socket.get('/groupfeed') which is done automatically by the blueprint api and then io.socket.on('groupfeed',function(obj){console.log(obj)}) would give me updates on the model changes when I

What would be the behavior of subscriptions and notifications in an Orion Load-Balancing scenario?

China☆狼群 提交于 2020-01-02 14:04:07
问题 Based on this answer about how to scale Orion Context Broker with load balancing https://stackoverflow.com/a/33068119/3706998 what should be the behavior of subscriptions and also notifications? Witch server should it come from? What is the workflow? Could it cause some disturbe or cloned subscriptions ? 回答1: Let's consider different cases, depending on subscription cache usage. Let's consider two Orion nodes (A and B) without loss of generality, both sharing the same MongoDB instance. Using

server push for millions of concurrent connections

主宰稳场 提交于 2020-01-02 03:23:06
问题 I am building a distributed system that consists of potentially millions of clients which all need to keep an open (preferrably HTTP) connection to wait for a command from the server (which is running somewhere else). The load of messages / commmands will not be very high, maybe one message / sec / 1000 clients which means it would be 1000 msg/sec @ 1 million clients. => it's basically about the concurrent connections. The requirements are simple too. One way messaging (server->client), only

Meteor: How to trigger reRun of helper function after collectionHandle.ready() is true

只愿长相守 提交于 2020-01-01 05:16:22
问题 This a new version of my old question: So thanks to Tom Coleman's help I finally figured out on how to properly check if a subscription is ready() or not. My current code structure looks like this: /client/app.js: eventsHandle = null; groupsHandle = null; // ... // First Deps.autorun(): // Does not depend on any Session var, should just run every time Deps.autorun(function() { eventsHandle = Meteor.subscribe("events", function() { console.log('Deps.autorun(): Events loaded'); }); }); //

Redis publish/subscribe: see what channels are currently subscribed to

不羁的心 提交于 2019-12-31 21:22:30
问题 I am currently interested in seeing what channels are subscribed to in a Redis pub/sub application I have. When a client connects to our server, we register them to a channel that looks like: user:user_id The reason for this is I want to be able to see who's "online". I currently blindly fire off messages to a channel without knowing if a client is online since it's not critical that they receive these types of messages. In an effort to make my application smarter, I'd like to be able to

Redis publish/subscribe: see what channels are currently subscribed to

人盡茶涼 提交于 2019-12-31 21:22:11
问题 I am currently interested in seeing what channels are subscribed to in a Redis pub/sub application I have. When a client connects to our server, we register them to a channel that looks like: user:user_id The reason for this is I want to be able to see who's "online". I currently blindly fire off messages to a channel without knowing if a client is online since it's not critical that they receive these types of messages. In an effort to make my application smarter, I'd like to be able to

Are multiple responses legal in HTTP?

守給你的承諾、 提交于 2019-12-31 02:20:25
问题 I'm a bit rusty on nuances of the HTTP protocol and I'm wondering if it can support publish/subscribe directly? HTTP is a request reponse protocol. So client sends a request and the server sends back a response. In HTTP 1.0 a new connection was made for each request. Now HTTP 1.1 improved on HTTP 1.0 by allowing the client to keep the connection open and make multiple requests. I realise you can upgrade an HTTP connection to a websocket for fast 2 way communications. What I'm curious about is