From 482b0d3ad876c34923e5411ba42ced44ee4284ec Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 29 Nov 2016 19:39:47 +1300 Subject: [PATCH] existential fixes for the synchronous API --- HubConnectionOptions.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/HubConnectionOptions.go b/HubConnectionOptions.go index 0274947..f24e668 100644 --- a/HubConnectionOptions.go +++ b/HubConnectionOptions.go @@ -11,7 +11,7 @@ type HubConnectionOptions struct { NumEventsToBuffer uint // Returning messages in sync mode - OnEventSync func(HubEvent) + OnEventSync func(*HubConnection, HubEvent) } func (this *HubConnectionOptions) prepareConnection() *HubConnection { @@ -54,5 +54,9 @@ func (this *HubConnectionOptions) Connect() *HubConnection { // Client code should supply an event handling function as hco.OnEventSync. func (this *HubConnectionOptions) ConnectSync() { hc := this.prepareConnection() + hc.OnEvent = nil + hc.processEvent = func(ev HubEvent) { + this.OnEventSync(hc, ev) + } hc.worker() }