add resubscribe (in progress)

fix crash when no bus found in map
This commit is contained in:
Adrian Zürcher
2025-05-28 22:00:04 +02:00
parent dc64d08e9d
commit b5d9d96c52
8 changed files with 72 additions and 17 deletions

View File

@@ -27,14 +27,19 @@ func NewClient(log *logging.Logger) *Client {
return &c
}
// Connect to websocket server
// ip: ip address of server
func (c *Client) Connect(ip, id string, port uint) (err error) {
c.conn, _, err = websocket.Dial(c.ctx, fmt.Sprintf("ws://%s:%d/ws?id=%s", ip, port, id), nil)
return
}
// Close connection to websocket server
func (c *Client) Disconnect() {
c.cancel()
}
// Subscribe to websocket server
func (c *Client) Subscribe(id string) error {
req := json_data.NewRequest()