add resubscribe (in progress)
fix crash when no bus found in map
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user