This message was deleted.
# ask-ai
s
This message was deleted.
g
To send the user's name from the client side to the agent on the server, you can use LiveKit's data channels to transmit custom data. On the client side, you can publish the user's name as a data packet using the
publishData
method. On the server side, the agent can listen for this data packet and process the user's name accordingly. Here's a basic example of how you might implement this: Client Side (JavaScript):
Copy code
await localParticipant.publishData(new TextEncoder().encode(JSON.stringify({
  type: 'user_info',
  name: 'UserName'
})), { reliable: true, topic: 'user_info' });
Server Side (Python):
Copy code
@ctx.room.on("data_received")
def on_data_received(data: rtc.DataPacket):
    if data.topic == "user_info":
        user_info = json.loads(data.data.decode("utf-8"))
        user_name = user_info.get('name')
        # Process the user's name as needed
This approach ensures that the user's name is sent reliably to the server when the chat starts. Would you like more details on this implementation? Sources: - Example of Data Packet Handling 👍 0 button 👎 1 button 💡 Hint: Mention @millions-hair-24956 in the thread for followups.