Skip to content

Commit 08c2894

Browse files
authored
Merge pull request #17 from tcriess/change-remove-json-double-encoding
Remove json double encoding in ws communication
2 parents e937aa9 + dad04cd commit 08c2894

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/App.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const App = () => {
5656
socket.send(
5757
JSON.stringify({
5858
event: "candidate",
59-
data: JSON.stringify(e.candidate),
59+
data: e.candidate,
6060
})
6161
);
6262
}
@@ -71,7 +71,7 @@ const App = () => {
7171
return;
7272
}
7373

74-
const offerCandidate = JSON.parse(msg.data);
74+
const offerCandidate = msg.data;
7575

7676
if (!offerCandidate) {
7777
console.log("Failed to parse offer msg data");
@@ -89,7 +89,7 @@ const App = () => {
8989
socket.send(
9090
JSON.stringify({
9191
event: "answer",
92-
data: JSON.stringify(answer),
92+
data: answer,
9393
})
9494
);
9595
} catch (e) {
@@ -104,7 +104,7 @@ const App = () => {
104104
case "info":
105105
dispatch({
106106
type: "info",
107-
viewers: JSON.parse(msg.data).no_connections,
107+
viewers: msg.data.no_connections,
108108
});
109109
}
110110
};

0 commit comments

Comments
 (0)