gotthardp/gen_coap

Multicast Support

JonGretar opened this issue · 1 comments

Multicast support would be a great for a setup I am planning here at home.

The server part is simple. Just adding the option {add_membership, {{224, 0, 1, 187}, {0,0,0,0}}} to gen_udp:open/2 when we want the server to accept multicast requests. Seems to work fine when I test it. Although I will have to read the rfc a bit better to see if more is required to be spec complete.

The problem arises with the client code in a few areas.

  • How the channels work causes problem because the reply comes from a different ip address than the one that the message was sent from.
  • It might get multiple replies from different ip addresses.
  • Not sure how to route the incoming messages to the correct client request reply.

I'll be happy to code something up and send a pull request. Just wanted to start with a discussion on how it could operate.

Although the client uses channels, each client opens just a single channel. The multiplexing logic is used only for the server. Therefore, the client channel should be fine, even if the source of a response is different.

Much worse is the problem with multiple responses. This affects the coap_transport. The RFC7390 says that "ACK" is never sent in response to multicast. I am tempted to say that multicast should be supported for NON-reliable only. If we say this, a solution to this problem could be a dedicated section in coap_transport handling multicast-non requests as described in the RFC. (NON is much simpler than CON.)