Created
December 23, 2019 09:44
-
-
Save avisiboni/2deec8949bb910dd9f6a3f32ad4c9f7d to your computer and use it in GitHub Desktop.
Send event from device function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static async Task SendEvent(DeviceClient deviceClient) | |
{ | |
var dataBuffer = JsonConvert.SerializeObject( | |
new | |
{ | |
Wind = 10, | |
Humidity = 70, | |
Precipitation = 0 | |
}); | |
var eventMessage = new Message(Encoding.UTF8.GetBytes(dataBuffer)); | |
// Add key value to each message for routing. | |
// key use for controller name, value for function to invoke | |
eventMessage.Properties.Add("Temp", "AddAsync"); | |
await deviceClient.SendEventAsync(eventMessage); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment