Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 2.19 KB

README.md

File metadata and controls

60 lines (42 loc) · 2.19 KB

DiscoveryV2

(DiscoveryV2)

Overview

Service that allows clients to directly ping all Hathora regions to get latency information

Available Operations

GetPingServiceEndpoints

Returns an array of all regions with a host and port that a client can directly ping. Open a websocket connection to wss://<host>:<port>/ws and send a packet. To calculate ping, measure the time it takes to get an echo packet back.

Example Usage

package main

import(
	"context"
	hathoracloud "github.com/hathora/cloud-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := hathoracloud.New(
        hathoracloud.WithOrgID("org-6f706e83-0ec1-437a-9a46-7d4281eb2f39"),
        hathoracloud.WithAppID("app-af469a92-5b45-4565-b3c4-b79878de67d2"),
    )

    res, err := s.DiscoveryV2.GetPingServiceEndpoints(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

[]components.PingEndpoints, error

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*