Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Room does not get closed #121

Open
qwertzui11 opened this issue Aug 17, 2022 · 0 comments
Open

Room does not get closed #121

qwertzui11 opened this issue Aug 17, 2022 · 0 comments

Comments

@qwertzui11
Copy link
Contributor

Hi there!

So I'm trying to close a room. I got a participant (client) using the server-sdk-go and another program called closer which tries to close the room.

client

package main

import (
	"fmt"

	"github.com/livekit/protocol/livekit"
	lksdk "github.com/livekit/server-sdk-go"
	"github.com/thanhpk/randstr"
)

func main() {
	host := "ws://localhost:7880"
	apiKey := "devkey"
	apiSecret := "secret"

	roomName := "myroom"
	identity := randstr.Hex(16)

	close := make(chan bool)

	roomCB := &lksdk.RoomCallback{
		ParticipantCallback: lksdk.ParticipantCallback{},
		OnReconnecting: func() {
			fmt.Print("OnReconnecting")
		},
		OnReconnected: func() {
			fmt.Print("OnReconnected")
		},
		OnDisconnected: func() {
			fmt.Print("OnDisconnected")
			close <- true
		},
	}
	room, err := lksdk.ConnectToRoom(host, lksdk.ConnectInfo{
		APIKey:              apiKey,
		APISecret:           apiSecret,
		RoomName:            roomName,
		ParticipantIdentity: identity,
	}, roomCB)
	if err != nil {
		panic(err)
	}

	<-close

	room.Disconnect()
}

closer

package main

import (
	"context"
	"fmt"

	livekit "github.com/livekit/protocol/livekit"
	lksdk "github.com/livekit/server-sdk-go"
)

func main() {
	host := "ws://localhost:7880"
	apiKey := "devkey"
	apiSecret := "secret"

	roomClient := lksdk.NewRoomServiceClient(host, apiKey, apiSecret)

	res_list, _ := roomClient.ListRooms(context.Background(), &livekit.ListRoomsRequest{})

	roomId := res_list.GetRooms()[0].GetSid()

	fmt.Printf("sid: '%s'\n", roomId)

	res_delete, err := roomClient.DeleteRoom(context.Background(), &livekit.DeleteRoomRequest{
		Room: roomId,
	})

	fmt.Printf("res_delete: '%s', error: %v\n", res_delete.String(), err)

	fmt.Printf("done\n")
}

issue

So there is no error, however the room does not get closed either. Simply nothing happens. Btw when I use an invalid roomId I get no error either.

the server logs DEBUG livekit service/roommanager.go:453 Deleting non-rtc room, loading from roomstore

I expected that the client will get disconnected and that the signal OnDisconnected would get called.

versions

  • github.com/livekit/server-sdk-go v0.10.4
  • docker run --rm -it --network host livekit/livekit-server:v1.1.2 --dev

Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant