Привет! Напиши мне js скрипт для определения сервера с наименьшим пингом. Для photon. You can get a list of available regions and then connect to the selected region with connectToRegionMaster() call.
First, connect to the nameserver with connectToNameServer(), then when the sate of the client changes to State.ConnectedToNameServer, call getRegions().
The list of the regions will arrive in LoadBalancingClient.onGetRegionsResult callback().
Note that ConnectedToNameServer state change is triggered also when you connect with connectToRegionMaster() because the nameserver is always connected first.
This is used in demo-loadbalancing to print a list of regions each time the client starts connection.