SSE/EventSource Not Working with Cluster Size > 1

24 views
Skip to first unread message

jcq

unread,
May 25, 2016, 5:59:25 PM5/25/16
to LoopbackJS
Using this code:
var url = apiBase + '/imports/change-stream?_format=event-stream';
console.log('Creating new EventSource', url);
var es = new EventSource(url);

es.addEventListener('data', (msg) => {
var changeObj = JSON.parse(msg.data);
console.log(changeObj);
});


If I set cluster size to 1,
slc ctl set-size SVC 1
everything works just fine. I get data output every time.

However, if I set cluster size to 2,
slc ctl set-size SVC 2
I don't receive any of the data packets.

Is there some setting I'm perhaps missing? I did remove compression from middleware.json, and I had to add these to my nginx config to make it send anything:
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;

However, my remaining issue seems to be isolated to the cluster support of Loopback. Both locally and on a remote server, I get data when size=1, but nothing from size=2.

Has anyone else encountered this issue and found some sort of solution?

Reply all
Reply to author
Forward
0 new messages