How to find shadow name from delta event? #525
-
Hello, I'm trying to set up my device to use named shadows. Upon startup: for N shadows, subscribe to get named shadow accepted/rejected, update named shadow accepted/rejected, and named shadow delta updated events. Upon handling the get,update responses I use the client_token to correlate the request and then find the shadow_name. But, upon handling the named shadow delta updated events, there is no client token, as events are events and aren't a response to a specific request that would have been made with a client token. So, all I have there is the ShadowDeltaUpdatedEvent and I'm not sure how to find the shadow_name. Please, how should one find the shadow name after receiving a ShadowDeltaUpdatedEvent? -Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
When you do a named shadow delta update subscribe, you pass in both the thing name and the shadow name as part of the request. The easiest way to get the shadow name on deltas is to capture it in a lambda that you use for the callback, which you pass in at the same time. If you want to have a single, central callback that takes the shadow name as well as the delta, use little lambdas that capture and pass the shadow name to your central callback. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
When you do a named shadow delta update subscribe, you pass in both the thing name and the shadow name as part of the request. The easiest way to get the shadow name on deltas is to capture it in a lambda that you use for the callback, which you pass in at the same time.
If you want to have a single, central callback that takes the shadow name as well as the delta, use little lambdas that capture and pass the shadow name to your central callback.