Table of Contents

Join a Room with Stream

Connecting and joining a Room is a complex chain of events. You will need to ensure success status of previous event to proceed to the next event. The following basic steps are required to join room successfully

  • Initiate Room & Connect
  • If connected, initiate Stream.
  • Publish Stream

joinRoom() method comes as a handy tool for developer. It handles all complexities of connecting and joining the room.

Method: static Future<void> joinRoom(String token, Map<String, dynamic> localInfo, Map<String, dynamic> roomInfo, List<dynamic> advanceOptions)


  • @param String token – JWT Token received through Server API Call
  • @param Map<String,dynamic> locfoStream Initialization Meta Info. Optional.
  • @param Map<String,dynamic> roomInfo – Room info for joining room

Event Listeners:

  • onRoomConnected – When Client End Point is connected to the room successfully
  • onRoomDisConnected – Client End Point got disconnected to the room
  • onRoomError – Client End Point’s attempt to connect to room has failed
  • onUserConnected – Everyone is notified that a new user is connected to the Room
  • onUserDisConnected – Everyone is notified that a connected user is disconnected from the Room
  • onConnectionLost – When End Point looses network connection
  • onConnectionInterrupted – When connection is interrupted e.g Switch from WiFi to 4G and vice versa
  • onUserReconnectSuccess – When End-Point successfully gets reconnected with EnableX
  • onReconnect – When End-Point trying to reconnect within given time period
  • onPublishedStream – Publisher is notified that its Stream has been published into the Room
  • onUnPublishedStream – Publisher is notified that its Stream is unpublished/removed from the Room
//Map<String, dynamic>: where localInfo is like below:

Map<String, dynamic> localInfo= {
	'audio': true,
	'video': true,
	'data': true,
	'audioMuted': false,
	'videoMuted': false,
	'name': 'flutter',

//Map<String, dynamic>: where roomInfo is like below:
Map<String, dynamic> roomInfo = {
	'allow_reconnect': true,
	'number_of_attempts': 3,
	'timeout_interval': 20,
	'audio_only': false,
	'forceTurn': false

//Method calling
await EnxRtc.joinRoom(token, localInfo, roomInfo, advanceOptions);

EnxRtc.onRoomConnected = (Map<dynamic, dynamic> map) {
	//Connection success

EnxRtc.onRoomError = (Map<dynamic, dynamic> map) {
	// Connection Failed or any error in room

EnxRtc.onRoomDisConnected = (Map<dynamic, dynamic> map) {
	// Called when room is disconnected success

EnxRtc.onConnectionLost = (Map<dynamic, dynamic> map) {
	// In case connection lost due to internet lose

EnxRtc.onConnectionInterrupted = (Map<dynamic, dynamic> map) {
	// In case any interruption in connection

EnxRtc.onUserReconnectSuccess = (Map<dynamic, dynamic> map) {
	// When reconnect done successfully

EnxRtc.onReconnect = (Map<dynamic, dynamic> map) {

Disconnect from a Room

A Client End Point can disconnect itself from the room to close its session. A disconnected End-Point will loose media and signaling socket immediately.

Method: static Flutter<void> disconnect() – Without any parameter