With calling particle.getEventStream() a second time you are creating a new stream which you end/abort, but that has no effect on any previously created stream (which is a seperate instance).
You need to act on the original instance to make your end/abort work on that one.
@ScruffR, thanks for the suggestion. Can you tell me how I can keep track of the instances? I don’t see anything similar to it returning from particle data object.
I’m not really into these promises (or JS at all ), but from my naive JS understanding you get the stream object in the then() callback.
There - I guess - you could assign that to a “global” variable which can be reused later on when you want to kill that stream.
I’m sure there are more elegant ways, but that’s what I’d do without really knowing what I’m doing.
Isn't that "stream" the Stream object you're trying to end (I'm not a JS programmer either, but I think this is what @ScruffR is talking about )? Can't you set a global variable equal to that, and then call end or abort on that global?