Websockets client!

Can you tell me what time took passing message to spacebrew and then receive in on Spark and parse on it in Your code?
I've testing this with clicking on html page with SpacebrewJS and then pass boolean message to spark. And message arriving so fast to spark then in parses about half of second... Thinking how to speed up this...

I thought to merge your comment here into this thread. Yes, I'm getting the same timings as you mentioned. Details below.

I have a button wired to D3 that sends a change in its state as a new message as a publisher to SpaceBrew.

I also have an LED wired to D1 that listens to incoming messages as a subscriber.


Timings and observations

Spacebrew to Spark (via HTML/JS boolean button example):

  1. Spacebrew JS button test - Pressed
  2. (0.6 seconds)
  3. serial onMessage displays valid JSON
  4. (0 seconds - almost instantaneous)
  5. LED lights up
  6. Spacebrew JS button test - Released
  7. (0.6 seconds)
  8. serial onMessage displays valid JSON

When do the freezes (and subsequent 'disconnects' from Spacebrew) happen:

  • clicking the HTML button rapidly to simulate a larger chunk of JSON data coming in
  • use another Spacebrew source that generates streaming data into the Spark's subscriber

Spark to Spacebrew:

  1. Button connected to Spark - Pressed
  2. (0.4 seconds)
  3. serial onMessage displays valid JSON
  4. (0.4 seconds)
  5. Spacebrew JS button test - background turns green
  6. Button connected to Spark - Released
  7. (0.4 seconds)
  8. serial onMessage displays valid JSON
  9. (0.4 seconds)
  10. Spacebrew JS button test - background turns grey

When do the freezes (and subsequent 'disconnects' from Spacebrew) happen:

  • just by pressing the button most of the time, freezes very easily

The 0.4s delay between the Spark button press and the onMessage serial output is interesting, because this delay is only present when the connection is good. There is no delay when the Spark recovers from the freeze, serial onMessage traces are output almost instantaneously (but it doesn't do anything besides tracing it in serial).