send method Null safety
this method is used to send json payload to Janus Server for communicating the intent.
Implementation
Future<dynamic> send(Map<String, dynamic> data, {int? handleId}) async {
if (data['transaction'] != null) {
data['session_id'] = sessionId;
if (handleId != null) {
data['handle_id'] = handleId;
}
sink!.add(stringify(data));
return parse(await stream.firstWhere((element) => (parse(element)['transaction'] == data['transaction']), orElse: () => {}));
} else {
throw "transaction key missing in body";
}
}