Skip to content

Can't connect to the same room back-to-back with the same token-device #93

Open
@merttalhayener

Description

@merttalhayener

I am developing a game on MacOS using Unity 6. Here, I am trying to switch to the LiveKit Client SDK (from Agora) to reflect the user's camera view and data exchange between different users in the room.

First of all my token have time to expire, so there is no problem there. Server on Cloud.

On my first join attempt I can successfully connect to the room and play for a while, performing scene transitions, share screen, send data before closing the game. However, when I reopen it and press the 'join' button, I cannot re-enter the same room. The operation fails (can't get Debug.Log(room.Name + " joined") debug). Since I am not receiving any error messages, I cannot determine the source of the problem.

It seems like I am connected to the Cloud Server again, but the connection bars are empty. Unity sees me as not connected, as if the information about my connection is not being relayed back to Unity from server.

When I press the 'join' button for the second time, I start receiving my own debug message, 'room is not null.' In other words, when I reopen the application for the second time, the room starts as null, so there should be no issue; since the token and device are the same, I should have been able to enter the same room as in other RTC solutions.

Error debugging must definitely be improved because I couldn't figure out what caused the issue.

private IEnumerator JoinRoom()
        {
            if (room == null)
            {
                room = new Room();
                room.TrackSubscribed += TrackSubscribed;
                room.TrackUnsubscribed += UnTrackSubscribed;
                room.DataReceived += DataReceived;
                room.ConnectionStateChanged += OnConnectionStateChange;
                
                var options = new RoomOptions();
                var connect = room.Connect(url, token, options);
                yield return connect;

                if (!connect.IsError)
                {
                   Debug.Log(room.Name + " joined");
                }
               
            }
            else
            {
                Debug.Log("Room is not null");
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions