27 lines
713 B
Go
27 lines
713 B
Go
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
|
|
}
|