particle-iot / spark-server

UNMAINTAINED - An API compatible open source server for interacting with devices speaking the spark-protocol
https://www.particle.io/
GNU Affero General Public License v3.0
441 stars 136 forks source link

Events not displaying properly #22

Closed kennethlimcp closed 8 years ago

kennethlimcp commented 10 years ago

Using spark subscribe i can see the events published by the core to the local cloud.

However, on the chrome browser, the only message displayed is the initial:

ok:

Maybe a better tool can be used to see if the events are publishing properly and able to be received by tools other than the spark-cli

dmiddlecamp commented 10 years ago

are you viewing source? The spark-cli is hitting the same api endpoint as in the browser, so there shouldn't be a difference there. We could optionally add a 'format' param to those endpoints to get a friendlier HTML view back, which might be nice.

kennethlimcp commented 10 years ago

Hmm.. There's 2 other guys who had the same issue. Doing it with the spark cloud publish events display well in just a chrome tab but not the local cloud

dmiddlecamp commented 10 years ago

okay, weird, I'll look into it. Thanks!

crimsonclyde commented 10 years ago

I think I am one of those guys ;) currently I did not get any result if i try to follow bko´s tutorial: https://community.spark.io/t/tutorial-getting-started-with-spark-publish/3422.

When I try to open the event with my browser (tested FF, chrome, safari) I get a stream that tries to save the file event. Sounds nice but a stream doesn´t ends, so I opened up the events.part file and the content is simply ":ok".

Code works with :spark: :cloud: but not in my local cloud instance. Sadly there is no output in the console I can paste in here. Let me know if I can help you!

crimsonclyde commented 10 years ago

Anything new on this? It would be awesome if I can red my events again from my website? Is there an update to the local cloud on the horizon or does anyone have looked into that issue?

chron0 commented 9 years ago

I had similar issues using chromium, spark-cli or curl with a local cloud instance:

$ spark subscribe Alert
Subscribing to "Alert" from the firehose (all cores) 
Listening to: /v1/events/Alert

and nothing more.

Same thing with curl:

$ curl -H "Authorization: Bearer ABCaccess_token789" http://10.1.1.1:8080/v1/events/Alert
:ok

always an empty line.

Serial debug shows that the event fires (at least the part where Spark.publish() is called), so I would reckon that spark-server somehow doesn't deal with the events. Not having events would mean having to poll all data all the time, which really is a show killer for many use cases.

Update:

After playing a bit more and realizing that my spark firmware code actually publishes events every 200ms when triggered, I throttled down to 500ms delay and suddenly I could see the events with curl and the spark-cli. So, if you're having similar issues, try to check/reduce the publish rate and see if that may help. It also worked in Chromium Version 37.0.2062.120 (281580) (64-bit) Browser Tab via:

http://10.1.1.1:8080/v1/events/Alert?access_token=ABCaccess_token789

kennethlimcp commented 9 years ago

I think only spark subscribe mine works for now

juano2310 commented 9 years ago

Same problem here. I can see the event in Spark-Cli if i subscribe to all events but can't on my web implantation.