Is it possible to use UDP with Web Sockets instead of TCP

3.7k Views Asked by At

I have a C# desktop app and a C# Server console app.

The C# desktop client app uses WebSocket4Net and my C# server app uses Fleck.

Am I right in assuming that it uses TCP protocol. If so, can I get it to use UDP protocol?

The reason I asking this is because I read TCP is slower than UDP because TCP ensures order of packets.

I read this from this article:

Making Fast-Paced Multiplayer Networked Games is Hard

1

There are 1 best solutions below

1
On BEST ANSWER

No, WebSockets are based on TCP which in turn is based on IP. UDP is also based on IP, but doesn't have anything to make sure the packets arrive in order or arrive at all. UDP just throws packets at a remote endpoint in the hope someone catches it. It's connectionless, so impossible to use UDP with WebSockets.