-
Notifications
You must be signed in to change notification settings - Fork 4
3. Messaging Examples
simen edited this page Aug 26, 2016
·
5 revisions
- Client pub a register request
{
transId: 12,
lifetime: 86400,
ip: '192.168.1.18',
mac: 'd8:fe:e3:e5:9f:3b',
version: '0.0.1',
objList: {
'3301': [ 0 ],
'3302': [ 6 ],
'3303': [ 0, 1, 18 ]
}
}
- Server pub back a register response
{
transId: 12,
status: 201 // Created
}
- Client pub a deregister request
{
transId: 231
}
- Server pub back a deregister response
{
transId: 231,
status: 202 // Deleted
}
- Client pub an update request
{
transId: 176,
lifetime: 86400, // optional
ip: '192.168.1.18', // optional
version: '0.0.1', // optional
objList: { // optional
'3301': [ 0 ],
'3302': [ 6 ],
'3303': [ 0, 1, 18 ]
}
}
- Server pub back an update response
{
transId: 176,
status: 204 // Changed
}
- Client pub a checkin/checkout indication
// (1) Checkin
{
transId: 88,
sleep: false
}
// (2) Checkout
{
transId: 88,
sleep: true,
duration: 0
}
// (3) Checkout with a duration
{
transId: 88,
sleep: true,
duration: 600 // will wake up after 600 seconds
}
- Server pub back a checkin/checkout acknowledgement
// Response for case (1), (2), and (3)
{
transId: 88,
status: 200 // OK
}
- Client pub a ping request
{
transId: 241
}
- Server pub back a ping response
{
transId: 241,
status: 200 // OK
}
- Client pub: none
- Server pub an announcement: Any thing can be serialized
'{"foo":"bar","greet":"hello world"}'
- Server Pub via request channel
{
transId: 26,
cmdId:
oid:
iid:
rid:
data:
}
- Client Pub via response channel
{
transId: 26,
cmdId:
status:
data:
}
- Client pub a notify indication
- Cannot notify the server of an Object
// (1) Notify an Object Instance
{
transId: 36,
oid: 3303,
iid: 0,
data: { // supports partial update, no need to notify with all Resources
sensorValue: 24,
units: 'Cel'
}
}
// (2) Notify a Resource
{
transId: 36,
oid: 3303,
iid: 0,
rid: 5700, // sensorValue
data: 27
}
- Server pub back a notify acknowledgement
{
transId: 36,
status: 204 // Changed
}
Overview
- APIs
- Events
- 'ready'
- 'error'
- 'permitJoinin'g
-
'ind'
- devIncoming, devLeaving, devUpdate, devNotify, devChange, devStatus
- 'message'
- APIs
Advanced Topics
Appendix