Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(terminal): preserve SDP line endings for deathmatch (#113750)

Marius Andraf0d8b0683677
diff --git a/posthog/api/terminal_netplay.py b/posthog/api/terminal_netplay.py
index 908b55543c0f..f2d547b53247 100644
--- a/posthog/api/terminal_netplay.py
+++ b/posthog/api/terminal_netplay.py
@@ -138,7 +138,10 @@ class TerminalNetplayRoom:
class TerminalNetplayDescriptionSerializer(serializers.Serializer):
type = serializers.ChoiceField(choices=["offer", "answer"], help_text="WebRTC session description type.")
- sdp = serializers.CharField(max_length=16384, help_text="WebRTC session description with ICE candidates.")
+ # Chrome requires the final SDP line ending when applying a remote description.
+ sdp = serializers.CharField(
+ max_length=16384, trim_whitespace=False, help_text="WebRTC session description with ICE candidates."
+ )
class TerminalNetplaySignalSerializer(serializers.Serializer):
diff --git a/posthog/api/test/test_terminal_netplay.py b/posthog/api/test/test_terminal_netplay.py
index 6b044814366c..1acc6000f841 100644
--- a/posthog/api/test/test_terminal_netplay.py
+++ b/posthog/api/test/test_terminal_netplay.py
@@ -18,8 +18,8 @@ from posthog.token_bucket import BucketUnavailable
if TYPE_CHECKING:
from rest_framework.response import _MonkeyPatchedResponse
-OFFER = {"type": "offer", "sdp": "v=0 offer"}
-ANSWER = {"type": "answer", "sdp": "v=0 answer"}
+OFFER = {"type": "offer", "sdp": "v=0\r\ns=offer\r\n"}
+ANSWER = {"type": "answer", "sdp": "v=0\r\ns=answer\r\n"}
class TestTerminalNetplay(APIBaseTest):