Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/modules/meeting/ws_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ async def signaling_websocket(
payload = json.loads(data)
target_user_id = payload.get("target_user_id")

# Always inject the sender's identity so the recipient knows
# who sent the offer/answer/ice_candidate. Without this,
# from_user_id is undefined on the frontend.
payload["from_user_id"] = user_id

# If target specified, unicast. Otherwise, broadcast.
if target_user_id:
await manager.send_to_user(room_code, target_user_id, payload)
Expand Down
4 changes: 3 additions & 1 deletion tests/meeting/test_ws_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def test_signaling_websocket(mock_connection_manager):

mock_connection_manager.connect.assert_called_once()
mock_connection_manager.send_to_user.assert_called_once_with(
"room1", "user2", {"type": "offer", "target_user_id": "user2"}
"room1",
"user2",
{"type": "offer", "target_user_id": "user2", "from_user_id": "user1"},
)
mock_connection_manager.disconnect.assert_called_once_with("room1", "user1")
assert mock_connection_manager.broadcast_to_room.call_count == 2
Expand Down
Loading