Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoAP trigger: discovery message type #92

Open
Adirio opened this issue Jun 28, 2017 · 1 comment
Open

CoAP trigger: discovery message type #92

Adirio opened this issue Jun 28, 2017 · 1 comment
Assignees

Comments

@Adirio
Copy link
Contributor

Adirio commented Jun 28, 2017

The discovery response message type is being send with both the same type and id as the request:

178	res := &coap.Message{
179		Type:      msg.Type,
180		Code:      coap.Content,
181		MessageID: msg.MessageID,
182		Token:     msg.Token,
183		Payload:   []byte(payloadStr),
184	}

There are two posibilities a confirmable (CON) and a non-confirmable (NON) request:

  1. CON: an acknowledgment (ACK) is required. The response can either be piggybacked in the ACK or in another message. Piggybacked is suggested when able and as discovery is straightforward, it would be as easy as changing the message type:
res := &coap.Message{
	Type:      coap.Acknowledgment,
	Code:      coap.Content,
	MessageID: msg.MessageID,
	Token:     msg.Token,
	Payload:   []byte(payloadStr),
}
  1. NON: the response can not be given as an ACK according to the spec. Using the same response type is suggested, but not enforced by the RFC. Message IDs are only shared with their corresponding ACKs, which is not the case. A new ID should be used, maybe randomly generated:
res := &coap.Message{
	Type:      coap.NonConfirmable,
	Code:      coap.Content,
	MessageID: generateNewId(),
	Token:     msg.Token,
	Payload:   []byte(payloadStr),
}
@Adirio
Copy link
Contributor Author

Adirio commented Jun 30, 2017

I would apreciate some feedback. I can submit a pull request myself but will not develop anything until one of the developers approves it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants