From 3c4972d930c33d48699e048ddb6bd764e8edc6bf Mon Sep 17 00:00:00 2001 From: mappu Date: Wed, 4 May 2016 19:17:20 +1200 Subject: [PATCH] HubConnection.Disconnect() function (via autoreconnect abuse) --- HubConnection.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/HubConnection.go b/HubConnection.go index 09df6ad..1968043 100644 --- a/HubConnection.go +++ b/HubConnection.go @@ -195,6 +195,14 @@ func (this *HubConnection) processProtocolMessage(message string) { } } +func (this *HubConnection) Disconnect() { + this.autoReconnect = false + if this.conn != nil { + this.conn.Close() + } + // A CONNECTIONSTATE_DISCONNECTED message will be emitted by the worker. +} + func (this *HubConnection) worker() { var fullBuffer string var err error = nil