handleServerEvent method
Handles the server event
Implementation
void handleServerEvent(Map<String, dynamic> json) {
if (!json.containsKey(JsonConstants.method)) {
_logger.severe(
"Server event lacks a field '${JsonConstants.method}'; JSON: $json");
return;
}
final method = json[JsonConstants.method];
if (!json.containsKey(JsonConstants.params)) {
_logger.severe(
"Server event '$method' lacks a field '${JsonConstants.params}'; JSON: $json");
return;
}
final params = json[JsonConstants.params];
switch (method) {
case JsonConstants.iceCandidate:
iceCandidateEvent(params);
break;
case JsonConstants.participantJoined:
participantJoinedEvent(params);
break;
case JsonConstants.participantPublished:
participantPublishedEvent(params);
break;
case JsonConstants.participantLeft:
participantLeftEvent(params);
break;
case JsonConstants.streamPropertyChanged:
streamPropertyChangedEvent(params);
break;
case JsonConstants.sendMessage:
sendMessageEvent(params);
break;
default:
_logger.severe(
" *************************************************************** ");
_logger.severe(
" *************** Unknown server event '$method' *************** ");
_logger.severe(
" *************************************************************** ");
}
}