postToConnection method

Future<void> postToConnection({
  1. required String connectionId,
  2. required Uint8List data,
})

Sends the provided data to the specified connection.

May throw GoneException. May throw LimitExceededException. May throw PayloadTooLargeException. May throw ForbiddenException.

Parameter connectionId : The identifier of the connection that a specific client is using.

Parameter data : The data to be sent to the client specified by its connection id.

Implementation

Future<void> postToConnection({
  required String connectionId,
  required Uint8List data,
}) async {
  ArgumentError.checkNotNull(connectionId, 'connectionId');
  ArgumentError.checkNotNull(data, 'data');
  await _protocol.send(
    payload: data,
    method: 'POST',
    requestUri: '/%40connections/${Uri.encodeComponent(connectionId)}',
    exceptionFnMap: _exceptionFns,
  );
}