how to mannualy forcefully create subsibtion for t...
# ask-ai
l
how to mannualy forcefully create subsibtion for two participants in a room.
t
Thanks for reaching out, Rajadurai. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m here to help with manually forcing a subscription between two participants. I need a bit more detail so I can give a precise, actionable answer. Could you confirm the following? • Are you using LiveKit? If not, which platform/SDK are you using (e.g., Agora, Zoom, a custom WebRTC app)? • Do you want to force the subscription from the client-side (one participant’s app) or from the server-side? • Which SDK / language are you using (JavaScript/TS browser SDK, React Native, Node, Go, etc.)? • Do you want to subscribe to a specific track (audio/video) or all tracks for the participant? • Are both participants already in the same room and visible to each other? If you are using LiveKit and want a quick hint while you reply: • On the client, you can control subscriptions with the participant/track APIs (for example, using
setTrackSubscribed()
on a RemoteParticipant to enable/disable a track). • On the server, LiveKit doesn’t provide a direct “force-subscribe this participant to that participant” API; server-side control is usually done by adjusting permissions or room options and influencing client behavior. If you want, I can provide exact client-side code for
setTrackSubscribed()
in your SDK once you tell me which one you use. Tell me the platform and SDK and I’ll give step-by-step code and any server-side suggestions.
l
give code in python SDK
t
Thanks — I’m replying about your request for Python SDK code to forcefully create a subscription between two participants in a room. I checked the available LiveKit client information and the Python SDK: there is no API in the Python SDK (or server-side API) that lets you directly force one participant to subscribe to another participant’s tracks. In LiveKit, subscriptions are controlled on the client side by the receiving client (the participant who will receive the track). That means you cannot programmatically make participant A subscribe to participant B purely from the server or from Python without the receiving client’s cooperation. What you can do instead • Client-side control: The receiving client can enable/disable subscriptions for remote tracks. In LiveKit client SDKs that run in the browser or mobile, this is done with APIs like
setTrackSubscribed()
(or equivalent event handlers like
track_subscribed
) to accept a track. If you can run or update the receiving client, I can provide exact code for the JavaScript/TypeScript SDK or another supported client SDK. • Influence via server-side: From the server (Python) you can adjust room configuration, participant permissions, publish/unpublish tracks, or send a signaling message to a client asking it to subscribe. But the final subscribe action must be performed by the receiving client. • Use a control message: If you control both clients, have your server send a control message (via data channel, REST push to the client app, or another signaling channel) instructing the receiving client to subscribe to a particular publisher’s tracks; then the client calls the appropriate SDK method to subscribe. Next steps I can help with • If you want client-side code, tell me which client SDK you’re using (Browser JS/TS, React, React Native, Flutter, etc.) and whether you want an example to subscribe a specific track or all tracks. I will provide step-by-step sample code. • If you control the clients but need Python examples for sending control messages or updating room state, tell me how you deliver control messages to clients (data channel, push, REST), and I’ll provide a Python snippet for that flow. • If you only have Python/server access and cannot change clients, tell me more about your constraints so I can suggest alternatives (for example, relaying tracks through a bot participant you control that can subscribe and forward media). Which option would you like to pursue? If you want client-side sample code, please confirm the client SDK and whether you want to subscribe to audio, video, or both. Sources: client-sdk-js | livekit/livekit_composite | DeepWiki | client-sdk-flutter | livekit/livekit_composite | DeepWiki