karlentwistle / ruby_home

Ruby HAP Server - HomeKit support for the Rubyist

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accessory doesn't send events to controller

karlentwistle opened this issue · comments

Accessory Sends Events to Controller

The accessory should support delivering notifications by sending an event message, which is an unsolicited HTTP response, over the TCP connection established by the controller. An event message has the same format as an HTTP response, but uses a protocol version of EVENT/1.0. Event messages must never interrupt a response that is already being sent. A response message must also never interrupt an event message. Either of these violations would result in the controller receiving a corrupt message. Event messages do not receive an HTTP response from the controller.

For example when the value of the "current temperature" value changes, the accessory sends the following unsolicited message to the controller:

EVENT/1.0 200 OK
Content-Type: application/hap+json
Content-Length: <length>
{
  "characteristics" : [
    {
      "aid" : 1,
      "iid" : 4,
      "value" : 23.0
    }
  ]
}