add optional endpoint to new client
This commit is contained in:
@@ -57,8 +57,11 @@ var upgrader = websocket.Upgrader{
|
||||
EnableCompression: false,
|
||||
}
|
||||
|
||||
func NewClient(ip, id 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}
|
||||
func NewClient(id, ip, endpoint string, port uint, logger *logging.Logger) (*Client, error) {
|
||||
if endpoint == "" {
|
||||
endpoint = "status"
|
||||
}
|
||||
u := url.URL{Scheme: "ws", Host: fmt.Sprintf("%s:%d", ip, port), Path: endpoint, RawQuery: "id=" + id}
|
||||
|
||||
c := &Client{
|
||||
id: id,
|
||||
|
Reference in New Issue
Block a user