CoapResponse.createResponse constructor

CoapResponse.createResponse(
  1. CoapRequest request,
  2. ResponseCode statusCode,
  3. CoapMessageType type, {
  4. Uri? location,
  5. Iterable<int>? payload,
})

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 ResponseCode statusCode,
  final CoapMessageType type, {
  final Uri? location,
  final Iterable<int>? payload,
}) =>
    CoapResponse(
      statusCode,
      type,
      location: location,
      payload: payload,
    )
      ..destination = request.source
      ..token = request.token;