This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
orion/reach/browser_connected.go

27 lines
713 B
Go
Raw Normal View History

2018-09-18 18:07:40 +02:00
package reach
import (
"github.com/pkg/errors"
)
const (
// EventBrowserConnected is emitted after the initial connection to the
// ReachView endpoint
EventBrowserConnected = "browser connected"
)
// sendBrowserConnected notifies the ReachView endpoint
// of a new connection.
// See misc/reachview/update_main.js line 297
func (c *Client) sendBrowserConnected() error {
payload := map[string]string{
"data": "I'm connected",
}
c.logf("sending '%s' event", EventBrowserConnected)
if err := c.conn.Emit(EventBrowserConnected, payload); err != nil {
return errors.Wrapf(err, "error while emitting '%s' event", EventBrowserConnected)
}
c.logf("'%s' event sent", EventBrowserConnected)
return nil
}