aloof-scooter-47164
10/09/2025, 5:11 PMtall-airline-16756
10/09/2025, 5:11 PMtall-airline-16756
10/09/2025, 5:11 PMaloof-scooter-47164
10/09/2025, 5:14 PMtall-airline-16756
10/09/2025, 5:14 PMCanPublish: false
CanSubscribe: false
CanPublishData: true
With these settings, your server can comfortably participate in text or byte streams for real-time data exchange, without dealing with any media.
Also, the server SDK is quite flexible—it lets you connect to multiple rooms at the same time by creating separate room instances, each with their own unique identity and room name. This means a single server process can manage different rooms for different clients seamlessly.
If you'd like, I’m here to help with more details or examples—just let me know!
Sources: README.md | packages/livekit-server-sdk/README.md | livekit/tests/data_stream_test.rs | Sending text | LiveKit Docs | Sending files & bytes | LiveKit Docsaloof-scooter-47164
10/09/2025, 5:18 PMtall-airline-16756
10/09/2025, 5:19 PMaloof-scooter-47164
10/09/2025, 5:28 PMtall-airline-16756
10/09/2025, 5:29 PMRoom object:
import { Room } from '@livekit/rtc-node';
const room = new Room();
1. Next, use the connect method to establish your connection. You’ll need to provide the LiveKit server URL, an access token, and any optional settings you want to use:
await room.connect(url, token, { autoSubscribe: true, dynacast: true });
Here, url is the WebSocket URL of your LiveKit server, and token is a JWT generated with the right permissions.
1. To generate that access token, you can use the livekit-server-sdk like this:
import { AccessToken } from 'livekit-server-sdk';
const at = new AccessToken(LIVEKIT_API_KEY, LIVEKIT_API_SECRET, {
identity: 'user-identity',
});
at.addGrant({
room: 'your-room-name',
roomJoin: true,
canPublish: false,
canSubscribe: false,
canPublishData: true,
});
const token = at.toJwt();
This token lets the server join the room and send or receive data messages, even if it’s not handling media itself.
1. Optionally, you can customize how the room behaves using the opts parameter, like turning on autoSubscribe or dynacast.
2. Don’t forget to add event listeners to manage room events such as TrackSubscribed or Disconnected.
If you have any questions or want me to walk you through more examples, just let me know—I’m here to help!
Sources: Connecting to LiveKit | LiveKit Docs | packages/livekit-server-sdk/README.mdaloof-scooter-47164
10/09/2025, 5:34 PMtall-airline-16756
10/09/2025, 5:34 PMRoom instances for each room you want to connect to. Each instance will independently connect to its own room with a unique identity and configuration, which gives you great flexibility.
Here’s a simple example to illustrate:
const room1 = new Room();
await room1.connect(url1, token1);
const room2 = new Room();
await room2.connect(url2, token2);
This way, your server can handle multiple rooms at the same time smoothly. If you have any questions or want me to walk you through more examples, just let me know—I’m here to help!aloof-scooter-47164
10/09/2025, 6:33 PMtall-airline-16756
10/09/2025, 6:33 PMlistRooms() method from the RoomServiceClient class. When you call this method without any parameters, it will return all active rooms on the server.
One thing to keep in mind is that the server SDK doesn’t provide a way to check if the server itself is connected to specific rooms. This is because the server SDK is designed to send commands to rooms through API calls, rather than maintaining real-time WebSocket connections like the client SDKs do.
If you'd like, I’m here to provide more details or examples—just let me know!
Sources: packages/livekit-server-sdk/src/RoomServiceClient.ts | test/singlenode_test.go | Managing rooms | LiveKit Docs | README.md | livekit/tests/room_test.rsaloof-scooter-47164
10/11/2025, 2:30 AMtall-airline-16756
10/11/2025, 2:31 AM