Determining the best region for a match
In this guide, we’ll explain how to use the Ping Service to select the best region when creating a room on Hathora. Each room must be assigned to a region, so selecting the optimal one is key to ensuring low latency for players. The Ping Service helps you measure the round-trip time (RTT) in milliseconds between the game client and Hathora’s data centers, allowing you to choose the best-performing server from 14 available regions.
Regions
The Ping Service supports multiple protocols, including UDP, ICMP, and Websocket. Each region has a unique URL, which you can use to measure latency from your players' devices.
You should ping each region 3-5 times and calculate the average round-trip time to help smooth out any outliers or occasional network fluctuations.
Region | UDP URL | ICMP URL | WebSocket URL |
---|---|---|---|
Seattle | seattle.ping.hathora.dev:10000 | seattle.ping.hathora.dev | wss://seattle.ping.hathora.dev:443 |
Los Angeles | losangeles.ping.hathora.dev:10000 | losangeles.ping.hathora.dev | wss://losangeles.ping.hathora.dev:443 |
Dallas | dallas.ping.hathora.dev:10000 | dallas.ping.hathora.dev | wss://dallas.ping.hathora.dev:443 |
Chicago | chicago.ping.hathora.dev:10000 | chicago.ping.hathora.dev | wss://chicago.ping.hathora.dev:443 |
Washington DC | washingtondc.ping.hathora.dev:10000 | washingtondc.ping.hathora.dev | wss://washingtondc.ping.hathora.dev:443 |
Sao Paulo | saopaulo.ping.hathora.dev:10000 | saopaulo.ping.hathora.dev | wss://saopaulo.ping.hathora.dev:443 |
London | london.ping.hathora.dev:10000 | london.ping.hathora.dev | wss://london.ping.hathora.dev:443 |
Frankfurt | frankfurt.ping.hathora.dev:10000 | frankfurt.ping.hathora.dev | wss://frankfurt.ping.hathora.dev:443 |
Johannesburg | johannesburg.ping.hathora.dev:10000 | johannesburg.ping.hathora.dev | wss://johannesburg.ping.hathora.dev:443 |
Dubai | dubai.ping.hathora.dev:10000 | dubai.ping.hathora.dev | wss://dubai.ping.hathora.dev:443 |
Mumbai | mumbai.ping.hathora.dev:10000 | mumbai.ping.hathora.dev | wss://mumbai.ping.hathora.dev:443 |
Tokyo | tokyo.ping.hathora.dev:10000 | tokyo.ping.hathora.dev | wss://tokyo.ping.hathora.dev:443 |
Sydney | sydney.ping.hathora.dev:10000 | sydney.ping.hathora.dev | wss://sydney.ping.hathora.dev:443 |
Singapore | singapore.ping.hathora.dev:10000 | singapore.ping.hathora.dev | wss://singapore.ping.hathora.dev:443 |
Integration Steps
Integrate Hathora's Ping Service into your matchmaking logic to dynamically choose the best server region for your players:
- Client-side Ping Requests: before a player connects to a game session, the client (game application) should ping all available server regions. Each ping request will return the round-trip time (RTT) between the player's device and the data center in milliseconds. The lower the RTT, the less delay players will experience.
- Server Selection in Matchmaking: once the game client has latency across all regions, it can send this data to your game's matchmaker or lobby service. In scenarios where players from different regions are connecting to the same match, your matchmaking system should find a region that provides an optimal balance for all players.