CoapResponse.createResponse constructor

CoapResponse.createResponse(
  1. CoapRequest request,
  2. CoapCode statusCode,
  3. CoapMessageType type
)

Creates a response to the specified request with the specified response code. The destination endpoint of the response is the source endpoint of the request. The response has the same token as the request. Type and ID are usually set automatically by the ReliabilityLayer>.

Implementation

factory CoapResponse.createResponse(
  final CoapRequest request,
  final CoapCode statusCode,
  final CoapMessageType type,
) =>
    CoapResponse(statusCode, type)
      ..destination = request.source
      ..token = request.token;