javascript room disconnect without stopTrack examp...
# ask-ai
a
javascript room disconnect without stopTrack example
t
Thanks for reaching out, 文凱. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like you want to leave a room in JavaScript without manually stopping tracks. You can simply call
room.disconnect()
. Example:
Copy code
import { Room } from 'livekit-client';

const room = new Room();
await room.connect(wsUrl, token);

// your app logic...

// cleanly leave the room (no stopTrack calls needed)
room.disconnect();
Notes: • If you don’t call
disconnect()
, the server will remove the participant after ~15 seconds. • More details: Connecting to LiveKit Sources: Connecting to LiveKit | LiveKit docs | Core Platform Architecture & Authentication | livekit/livekit_composite | D...
a
I want disconnect with stopTracks:false
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
a
TypeError: Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender. when I disconnect