I am beginning to work on a new project that involves communication between various IOT devices. For example: device A is a robot, device B is a server, and device C is a remote control for the robot. There will be many-to-many interactions between the devices.
- Device A <==> Device B
- Device A <==> Device C
- Device B <==> Device C
My question is, what is the best practice for designing a messaging system between the devices? For example, when sending a message between Device A and Device B, should each of the devices share an enumeration of different type of messages (Ex: Message Code 1, Message Code 2, Message Code 3, etc.)? Should each message follow a key/value schema, where the key is the code and the value is the payload? It seems it can get quite complicated when there are over 30 types of message types. I'd like to follow a good design to avoid messy handling of messages. Thank you.
Aucun commentaire:
Enregistrer un commentaire