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
public byte[] RawData {
get {
setData ();
return _rawData;
}
}
e.RawData property of websocket message event calls the same setData() method, which is used for e.Data property:
public string Data {
get {
setData ();
return _data;
}
}
And setData() method, when called for the first time for a given event object and if opcode is not Binary, unconditionally tries to decode byte array to string via TryGetUTF8DecodedString() method in order to prepare string _data field for e.Data property to use (even if called from e.DataRaw, where byte array to string decoding is not needed):
Calling _rawData.TryGetUTF8DecodedString on e.RawData property call prior to returning just _rawData byte array breaks the point of using e.RawData property for the purpose of message processing speedup via avoiding string allocation and byte array to string conversion.
I suppose the e.RawData property should be reworked like this:
public byte[] RawData {
get {
return _rawData;
}
}
The text was updated successfully, but these errors were encountered:
In this file: https://github.com/sta/websocket-sharp/blob/master/websocket-sharp/MessageEventArgs.cs
e.RawData property of websocket message event calls the same setData() method, which is used for e.Data property:
And setData() method, when called for the first time for a given event object and if opcode is not Binary, unconditionally tries to decode byte array to string via TryGetUTF8DecodedString() method in order to prepare string _data field for e.Data property to use (even if called from e.DataRaw, where byte array to string decoding is not needed):
Calling _rawData.TryGetUTF8DecodedString on e.RawData property call prior to returning just _rawData byte array breaks the point of using e.RawData property for the purpose of message processing speedup via avoiding string allocation and byte array to string conversion.
I suppose the e.RawData property should be reworked like this:
The text was updated successfully, but these errors were encountered: