1 Commits

Author SHA1 Message Date
Adrian Zuercher
567d2fe03d add optional endpoint to new client 2025-08-24 21:18:43 +02:00
2 changed files with 6 additions and 3 deletions

View File

@@ -57,8 +57,11 @@ var upgrader = websocket.Upgrader{
EnableCompression: false, EnableCompression: false,
} }
func NewClient(ip, id string, port uint, logger *logging.Logger) (*Client, error) { func NewClient(id, ip, endpoint string, port uint, logger *logging.Logger) (*Client, error) {
u := url.URL{Scheme: "ws", Host: fmt.Sprintf("%s:%d", ip, port), Path: "status", RawQuery: "id=" + id} if endpoint == "" {
endpoint = "status"
}
u := url.URL{Scheme: "ws", Host: fmt.Sprintf("%s:%d", ip, port), Path: endpoint, RawQuery: "id=" + id}
c := &Client{ c := &Client{
id: id, id: id,

View File

@@ -43,7 +43,7 @@ func NewStatusClient(serviceName, ip string, port uint, debug bool) (*StatusClie
} }
// connect underlying websocket client // connect underlying websocket client
sc.client, err = models.NewClient(ip, serviceName, port, logger) sc.client, err = models.NewClient(serviceName, ip, "", port, logger)
if err != nil { if err != nil {
return nil, err return nil, err
} }