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
|
|
}
|