Skip to content

Golang SDK ConnectToRoom Times Out While Python SDK Connects Successfully #665

@leejiliang

Description

@leejiliang

Description

When using the LiveKit Golang SDK (github.com/livekit/server-sdk-go/v2) to join a room, the ConnectToRoom function fails with the error could not connect after timeout. However, the Python SDK connects to the same server and room successfully under identical conditions. Both tests are run on the same machine, and the room is pre-created using LiveKit CLI.

Environment

Golang SDK Version: github.com/livekit/server-sdk-go/v2 v2.8.1
Go Version: go1.24.3
LiveKit Server: Self-hosted (Docker)
OS: Linux (amd64)
Network: Same machine for both Golang and Python tests

Golang Code
func TestJoinInRoom(t *testing.T) { info := lksdk.ConnectInfo{ APIKey: "xxxxx", APISecret: "yyyyyyy", RoomName: "UNKNOW-TEpM", ParticipantIdentity: "myIdentity", ParticipantName: "myName", } room, err := lksdk.ConnectToRoom("http://192.168.0.152:7880", info, &lksdk.RoomCallback{ OnDisconnected: func() { t.Log("do nothing") }, }) if err != nil { t.Fatalf("Failed to connect: %v", err) } else { t.Fatalf("success %v", room.Metadata()) } }
Observe the error

=== RUN TestJoinInRoom
JoinRoom_test.go:22: Failed to connect: could not connect after timeout
--- FAIL: TestJoinInRoom (16.04s)

FAIL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions