ChangeStream not firing any update on Angularjs

146 views
Skip to first unread message

Paolo Sinelli

unread,
Sep 28, 2015, 5:42:59 PM9/28/15
to LoopbackJS

I'm using Angular Live Set in my application, but despite using the code provided in the demo, I am not receiving any event in my controller.


var changeStreamUrl = '/api/todo/change-stream?_format=event-source';
var src = new EventSource(changeStreamUrl);
var changes = createChangeStream(src);

changes
.on('data', function (update) {
  console
.log('new data');
});

changes
.on('error', function (update) {
  console
.log('error data');
});

changes
.on('end', function (update) {
  console
.log('end data');
});

I think the problem could be the server not emitting any event: how can I debug what's wrong with the endpoint?

Sean Brookes

unread,
Sep 28, 2015, 7:27:03 PM9/28/15
to loopb...@googlegroups.com
check your middleware.json file in the server dir.

remove: ""compression": {},"

There seems to be an issue with compression.  I though a fix had been pushed or the README updated.

try it and see if it helps.

Sean

--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/e1e9426d-981d-4aec-ab5a-d05643b47acb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
StrongLoop makes it easy to develop APIs in Node, plus get DevOps capabilities like monitoring, debugging and clustering.

Paolo Sinelli

unread,
Sep 29, 2015, 11:40:00 AM9/29/15
to LoopbackJS
Thanks Sean, this fixed the problem.
The only reference I found about compression is in the realtime server events documentation but it doesn't mention you need to remove the entire line for it to work.

BTW, it works now.
Thanks.
Reply all
Reply to author
Forward
0 new messages