// create a new connection func newWSClient(t *testing.T) *client.WSClient { wsc := client.NewWSClient(websocketAddr, websocketEndpoint) if _, err := wsc.Start(); err != nil { t.Fatal(err) } return wsc }
func NewEventMeter(addr string, unmarshalEvent EventUnmarshalFunc) *EventMeter { em := &EventMeter{ wsc: client.NewWSClient(addr, "/websocket"), events: make(map[string]*EventMetric), timer: metrics.NewTimer(), receivedPong: true, unmarshalEvent: unmarshalEvent, done: make(chan struct{}), } em.QuitService = *NewQuitService(log, "EventMeter", em) return em }