Pre-launch.NetCraftGames is not accepting customers yet. Launch happens only after its public checks pass.See launch statusJoin the waitlist

Guides

WebSocket vs UDP for browser multiplayer

A browser cannot open a raw UDP socket, so browser games use WebSocket (reliable, ordered, over TCP) or WebRTC data channels (can be unreliable and unordered). Native games should prefer UDP. Choose by who your players are, not by habit.

By Charging Bull SoftwareLast updated:

The short answer

If any of your players use a web browser, you need WebSocket or WebRTC. Native clients on Windows, macOS, Linux, Android and iOS can use UDP, which handles packet loss more gracefully. Many teams run both: UDP for native, WebSocket for web, one authoritative server behind them.

How they differ

Native UDP (ENet, KCP, Unity Transport)WebSocketWebRTC data channel
Runs in a browserNoYesYes
Transport underneathUDPTCPUDP (DTLS/SCTP)
Ordering and reliabilityYour choice per messageAlways reliable and orderedConfigurable
Effect of a lost packetOnly that packetDelays everything behind itDepends on settings
Needs a serverYes (dedicated)Yes (dedicated)Signaling server, peers connect directly
Network traversalServer has a public addressServer has a public addressICE; may need a TURN relay
From an HTTPS pagen/aMust be wss://Allowed

Head-of-line blocking, in plain words

TCP delivers bytes in order. If one packet is lost, later packets wait until it is retransmitted, even if they already arrived. For a turn-based or slower game that is invisible. For a fast action game on a flaky connection it shows up as stutter. UDP lets you drop stale state and send the newest, which is why fast games prefer it.

Choosing

  • Turn-based, card, puzzle, or slow co-op in the browser: WebSocket to an authoritative server is the simplest and the most reliable to host.
  • Fast action in the browser: consider WebRTC data channels, accepting connectivity risk, or keep WebSocket messages small and use client prediction.
  • Native only: use UDP and skip the browser lane.
  • Both: run one authoritative server that speaks both transports, or one server per transport.

What this means on NetCraftGames

Mixed content, the classic web trap

A page served over HTTPS may only open secure WebSocket connections. A game that works on http://localhost with ws:// will fail in production unless it uses wss://. The gateway terminates TLS so your server does not need certificates.

Frequently asked questions

Can a browser game use UDP?

Not directly. Browsers do not expose raw UDP sockets to web pages. They offer WebSocket, which runs over TCP, and WebRTC data channels, which run over UDP-based protocols and can be unreliable and unordered. Native clients can use real UDP, so many games offer UDP for native and WebSocket for browsers.

Is WebSocket fast enough for a multiplayer game?

For turn-based, card, puzzle and many co-op games, yes. For fast action on unreliable networks it can stutter, because TCP holds later data behind a lost packet. Keep messages small, send state snapshots instead of every event, use client prediction, or evaluate WebRTC data channels if you accept the connectivity trade-offs.

Sources