コード例 #1
0
ファイル: helpers.go プロジェクト: eris-ltd/tendermint
// 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
}
コード例 #2
0
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
}