✅ c# websocket i want to disable utf8 validation on `WebSocketMessageType.Text`

I send strings with special characters and the server throws me
WebSocket Exception: System.Net.WebSockets.WebSocketException (0x83760002): Invalid data format for the specific protocol operation.
in System.Net.WebSockets.WebSocketProtocolComponent.WebSocketGetAction(WebSocketBase webSocket, ActionQueue actionQueue, Buffer[] dataBuffers, UInt32& dataBufferCount, Action& action, BufferType& bufferType, IntPtr& actionContext)
at System.Net.WebSockets.WebSocketBase.WebSocketOperation.Process(Nullable`1 buffer, CancellationToken cancellationToken)
WebSocket Exception: System.Net.WebSockets.WebSocketException (0x83760002): Invalid data format for the specific protocol operation.
in System.Net.WebSockets.WebSocketProtocolComponent.WebSocketGetAction(WebSocketBase webSocket, ActionQueue actionQueue, Buffer[] dataBuffers, UInt32& dataBufferCount, Action& action, BufferType& bufferType, IntPtr& actionContext)
at System.Net.WebSockets.WebSocketBase.WebSocketOperation.Process(Nullable`1 buffer, CancellationToken cancellationToken)
29 Replies
asdf
asdf2w ago
Send it as binary then
glacinefrox
glacinefroxOP2w ago
i want to have separated actual binary packet from string ones so i dont have to use a custom encoder to encode and decode metadata to payload
asdf
asdf2w ago
Why does the string have special characters that are invalid utf-8
FestivalDelGelato
yeah i don't believe you can change encoding, utf-8 is probably the standard for the protocol
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
i send text but has special characters i hate this pointless cvheck that noone cwants
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
Cause it's a check that nobody asked and can't be disabled Other libs have them
glacinefrox
glacinefroxOP2w ago
GitHub
Option to skip utf-8 check · Issue #1924 · websockets/ws
I've searched for any related issues and avoided creating a duplicate issue. Description I was wondering if it would be interesting to have an option (disabled by default) to skip the UTF-8 che...
glacinefrox
glacinefroxOP2w ago
You will make me install a third party library Yes it's hard coded on the websocket code
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
The check yes It's literally throwing me an exception
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
When Im reading stream
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
Who is throwing the exception is the .net websocket lib lol
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
It's an example
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
Showing that other ones
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
Let you disable it Yes but pisses me off
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
Yes but all of them it's yo change the way I encode the data I will use message pack Sound good
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
Or I'll do my simple packet encoder
Unknown User
Unknown User2w ago
Message Not Public
Sign In & Join Server To View
glacinefrox
glacinefroxOP2w ago
But maybe I want something simpler that fits my needs That can be archived with few lines of code
MODiX
MODiX2w ago
If you have no further questions, please use /close to mark the forum thread as answered

Did you find this page helpful?