You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Messages/Events send to StreamDeckLib are not received completely (split in half), therefor json-Parsing fails and therefor the Event is missed. The resulting jsonString suddenly ends, the second half is received with the next ReceiveAsync.
To Reproduce
Difficult - modified & self compiled copy of StreamDeckLib. Roughly: compiled as .NET Framework, ConnectionManager.Run modified to repeatedly call my Code. On top of that, it only happens in some combination / quantity of my plugin-buttons.
Expected behavior
Receiving the whole Message / Event ;)
Proposed Fix
public async Task GetMessageAsString(CancellationToken token)
{
byte[] buffer = new byte[65536];
ArraySegment segment = new ArraySegment(buffer, 0, buffer.Length); ;
WebSocketReceiveResult result = new WebSocketReceiveResult(0, WebSocketMessageType.Text, false);
int totalCount = 0;
while (!result.EndOfMessage)
{
result = await _Socket.ReceiveAsync(segment, token);
totalCount += result.Count;
segment = new ArraySegment(buffer, totalCount, buffer.Length - totalCount);
}
string jsonString = Encoding.UTF8.GetString(buffer);
return jsonString;
}
The text was updated successfully, but these errors were encountered:
Describe the bug
Messages/Events send to StreamDeckLib are not received completely (split in half), therefor json-Parsing fails and therefor the Event is missed. The resulting jsonString suddenly ends, the second half is received with the next ReceiveAsync.
To Reproduce
Difficult - modified & self compiled copy of StreamDeckLib. Roughly: compiled as .NET Framework, ConnectionManager.Run modified to repeatedly call my Code. On top of that, it only happens in some combination / quantity of my plugin-buttons.
Expected behavior
Receiving the whole Message / Event ;)
Proposed Fix
public async Task GetMessageAsString(CancellationToken token)
{
byte[] buffer = new byte[65536];
ArraySegment segment = new ArraySegment(buffer, 0, buffer.Length); ;
WebSocketReceiveResult result = new WebSocketReceiveResult(0, WebSocketMessageType.Text, false);
int totalCount = 0;
while (!result.EndOfMessage)
{
result = await _Socket.ReceiveAsync(segment, token);
totalCount += result.Count;
segment = new ArraySegment(buffer, totalCount, buffer.Length - totalCount);
}
string jsonString = Encoding.UTF8.GetString(buffer);
}
The text was updated successfully, but these errors were encountered: