Could someone help me with the correct syntax to subscribe to a hub variable change from inside an App that I'm writing?
The documentation here shows:
subscribe(location, "variable:variable-name", "myHandlerMethodName")`
subscribe(location, "variable:variable-name.value", "myHandlerMethodName")`
and I've also seen
subscribe(location, "$varName", "methodName")
but neither of these formats calls the handler when the variable value changes.
Thanks!
The first two are correct, but the third one could be basically the same depending on the value of varName
(without any context as to where you saw this, it's impossible to say).
You can verify in Logs > Location Events that the event names you're using matches the event that was actually generated on your hub. I'm sure you're aware that variable-name
and value
are intended to be replaced with the actual name and (if you only want this specific event) value, not used literally.
If that does not help, I suggest creating a minimal example app,that demonstrates the problem, and someone can probably help figure it out.
1 Like