handleMessage method

void handleMessage(
  1. MessagePayload payload
)

Implementation

void handleMessage(MessagePayload payload) {
  switch (payload.type) {
    case 'joined-meeting':
      joinedMeeting(JoinedMeetingData.fromJson(payload.data));
      break;
    case 'user-joined':
      userJoined(UserJoinedData.fromJson(payload.data));
      break;
    case 'connection-request':
      receivedConnectionRequest(UserJoinedData.fromJson(payload.data));
      break;
    case 'offer-sdp':
      receivedOfferSdp(OfferSdpData.fromJson(payload.data));
      break;
    case 'answer-sdp':
      receivedAnswerSdp(AnswerSdpData.fromJson(payload.data));
      break;
    case 'user-left':
      userLeft(UserLeftData.fromJson(payload.data));
      break;
    case 'meeting-ended':
      meetingEnded(MeetingEndedData.fromJson(payload.data));
      break;
    case 'icecandidate':
      setIceCandidate(IceCandidateData.fromJson(payload.data));
      break;
    case 'video-toggle':
      listenVideoToggle(VideoToggleData.fromJson(payload.data));
      break;
    case 'audio-toggle':
      listenAudioToggle(AudioToggleData.fromJson(payload.data));
      break;
    case 'not-found':
      handleNotFound();
      break;
    default:
      break;
  }
}