Skip to content

Commit

Permalink
Merge pull request #21 from galt-tr/missingMethods
Browse files Browse the repository at this point in the history
Add missing websocket methods
  • Loading branch information
mergify[bot] authored Apr 2, 2022
2 parents fb395c5 + 245fa0d commit d7abd92
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ type SocketHandler interface {
OnError(*centrifuge.Client, centrifuge.ErrorEvent)
OnMessage(*centrifuge.Client, centrifuge.MessageEvent)
OnServerPublish(*centrifuge.Client, centrifuge.ServerPublishEvent)
OnServerSubscribe(*centrifuge.Client, centrifuge.ServerSubscribeEvent)
OnServerUnsubscribe(*centrifuge.Client, centrifuge.ServerUnsubscribeEvent)
OnServerJoin(*centrifuge.Client, centrifuge.ServerJoinEvent)
OnServerLeave(*centrifuge.Client, centrifuge.ServerLeaveEvent)
}

// NewMempoolWebsocket instantiates a new websocket client to stream mempool transactions
Expand Down
12 changes: 12 additions & 0 deletions websocket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ func (h *testHandler) OnServerPublish(_ *centrifuge.Client, _ centrifuge.ServerP
func (h *testHandler) OnError(_ *centrifuge.Client, _ centrifuge.ErrorEvent) {
log.Printf("error")
}
func (h *testHandler) OnServerJoin(_ *centrifuge.Client, _ centrifuge.ServerJoinEvent) {
log.Printf("server join event")
}
func (h *testHandler) OnServerLeave(_ *centrifuge.Client, _ centrifuge.ServerLeaveEvent) {
log.Printf("server leave event")
}
func (h *testHandler) OnServerSubscribe(_ *centrifuge.Client, _ centrifuge.ServerSubscribeEvent) {
log.Printf("server subscribe event")
}
func (h *testHandler) OnServerUnsubscribe(_ *centrifuge.Client, _ centrifuge.ServerUnsubscribeEvent) {
log.Printf("server unsubscribe event")
}

func TestClient_NewMempoolWebsocket(t *testing.T) {
type args struct {
Expand Down

0 comments on commit d7abd92

Please sign in to comment.