I’m trying to get two cores to publish events to each other. If I subscribe to an event from ‘MY_DEVICES’ on one and publish that event PUBLICLY on the other then it works ok and I can see some lights flash for confirmation.
eg
Spark.publish(“temperature”, “data”);
If I try and publish a PRIVATE event in the same scenario then nothing happens and the second core doesn’t pick it up.
eg
Spark.publish(“temperature”, “data”, 60, PRIVATE);
The subscribe portion works ok filtering by my devices (i.e. I don’t see a thousand’s people temperature events being received).
Both cores would need to be registered to the same user-account to see private events published by one on the other. I guess I don’t totally understand, it sounds like you said the subscribe part is filtering for messages from your devices.
Your private events appear public only to you, if you were to login as another user, and view the firehose, or query for your event names, they would not appear if they were published privately.
To clarify, I subscribe to the temperature event for my devices in the app setup:
Spark.subscribe(“temperature”, myHandler, MY_DEVICES);
If I have the following in my app (public message) it works ok:
Spark.publish(“temperature”, “test”);
If I try and publish privately it doesn’t, the app carries on running fine but the subscribing core never sees the message:
Spark.publish(“temperature”, “test”, 60, PRIVATE);
Public messages work fine, private subscribing works fine, private publishing does not. At least you can subscribe to only your events so that your core will only respond to a message from you, but your messages are published publicly to the firehose.
In my tests I tried both testing on the same core and on two cores that were owned by the same user (me) and on the same account (mine). Neither worked…