sendRequest method
Implementation
Future<Response> sendRequest(String type, Map<String, dynamic> request, {Uint8List? data}) async {
final requestId = protocol.getNextMessageId();
final pr = _PendingRequest();
_pendingRequests[requestId] = pr;
final message = packMessage(request, data);
await protocol.send(type, message, id: requestId);
final response = await pr.fut;
if (response is ErrorResponse) {
throw RoomServerException(response.text);
}
return response;
}