I hope this question seems easy for someone.
What should I put in the ‘eventListenerID’?
if let sid = eventListenerID {
SparkCloud.sharedInstance().unsubscribeFromEvent(withID: sid)
}
I hope this question seems easy for someone.
What should I put in the ‘eventListenerID’?
if let sid = eventListenerID {
SparkCloud.sharedInstance().unsubscribeFromEvent(withID: sid)
}
The ID you received from:
var eventListenerID : Any?
eventListenerID = SparkCloud.sharedInstance().subscribeToMyDevicesEvents(withPrefix: "temp", handler: handler)
(or similar method, there are others returning eventListenerID). Or if you want to chuck out all subscriptions:
SparkCloud.sharedInstance().unsubscribeFromEvent(withID: "")
Thanks a lot! I’ve only used this code earlier so I’ve not thought about the ‘eventListenerID’:
var handler : Any?
handler = SparkCloud.sharedInstance().subscribeToAllEvents(withPrefix: "temp", handler: { (event :SparkEvent?, error : Error?) in
if let _ = error {
print ("could not subscribe to events")
} else {
DispatchQueue.main.async(execute: {
print("got event with data \(event?.data)")
})
}
})