Rooms

A Room is the core concept in ConoStream. It's a virtual space where participants can join, publish media, and interact with each other in real-time.

Room Lifecycle

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│  CONNECTING │ ──► │  CONNECTED  │ ──► │DISCONNECTED │
└─────────────┘     └─────────────┘     └─────────────┘
       │                   │                   ▲
       │                   │                   │
       ▼                   ▼                   │
┌─────────────┐     ┌─────────────┐           │
│   FAILED    │     │RECONNECTING │ ──────────┘
└─────────────┘     └─────────────┘

Creating & Joining a Room

// Connect to a room
manager.connect(serverUrl, token, new ConoStreamEventListener() {
    @Override
    public void onConnected() {
        Log.d("Room", "Connected to room");
    }

    @Override
    public void onDisconnected() {
        Log.d("Room", "Left the room");
    }

    @Override
    public void onReconnecting() {
        Log.d("Room", "Connection lost, reconnecting...");
    }

    @Override
    public void onError(String error) {
        Log.e("Room", "Error: " + error);
    }
});

Room Properties

Property Type Description
name String Unique room identifier
state RoomState Current connection state
localParticipant LocalParticipant Your local participant
remoteParticipants Map Other participants in room

Leaving a Room

// Gracefully leave the room
manager.leaveRoom();

// Or disconnect immediately
manager.disconnect();

Room Events

Listen for various room events:

ℹ️

Rooms are automatically created when the first participant joins and destroyed when all participants leave.