Skip to content

Commit de28ff9

Browse files
committed
fix: Only send one JSON array per websocket packet
While the C# client can parse multiple JSON bodies in a string, JS can't, and gets tripped on this. Fixes#645
1 parent fccf1d6 commit de28ff9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Buttplug.Server.Connectors.WebsocketServer/ButtplugWebsocketServerSession.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ public async Task RunServerSession()
117117
try
118118
{
119119
_outgoingMessages.TryReceiveAll(outvarmsgs);
120-
varoutMsgs=msgs.Aggregate(string.Empty,(current,msg)=>current+msg);
121120
if(_ws!=null&&_ws.IsConnected)
122121
{
123-
await_ws.WriteStringAsync(outMsgs,_linkedCancelSource.Token).ConfigureAwait(false);
122+
foreach(varmsginmsgs)
123+
{
124+
await_ws.WriteStringAsync(msg,_linkedCancelSource.Token).ConfigureAwait(false);
125+
}
124126
}
125127

126128
writeTask=_outgoingMessages.OutputAvailableAsync(_linkedCancelSource.Token);

0 commit comments

Comments
 (0)
close