From 6686c68dc546d405cd555dd775791ad243261366 Mon Sep 17 00:00:00 2001
From: Kavin <kavinapps@gmail.com>
Date: Thu, 25 Jul 2019 09:59:37 +0800
Subject: [PATCH] #58 fix open socket with custom header issue

---
 Example/StompClientLib.swift                | 4 +++-
 StompClientLib/Classes/StompClientLib.swift | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Example/StompClientLib.swift b/Example/StompClientLib.swift
index 591787a..20a9176 100755
--- a/Example/StompClientLib.swift
+++ b/Example/StompClientLib.swift
@@ -134,7 +134,9 @@ public class StompClientLib: NSObject, SRWebSocketDelegate {
     private func connect() {
         if socket?.readyState == .OPEN {
             // Support for Spring Boot 2.1.x
-            connectionHeaders = [StompCommands.commandHeaderAcceptVersion:"1.1,1.2"]
+            if (connectionHeaders == nil) {
+                connectionHeaders = [StompCommands.commandHeaderAcceptVersion:"1.1,1.2"]
+            }
             // at the moment only anonymous logins
             self.sendFrame(command: StompCommands.commandConnect, header: connectionHeaders, body: nil)
         } else {
diff --git a/StompClientLib/Classes/StompClientLib.swift b/StompClientLib/Classes/StompClientLib.swift
index a25e16f..9ee281f 100755
--- a/StompClientLib/Classes/StompClientLib.swift
+++ b/StompClientLib/Classes/StompClientLib.swift
@@ -134,7 +134,9 @@ public class StompClientLib: NSObject, SRWebSocketDelegate {
     private func connect() {
         if socket?.readyState == .OPEN {
             // Support for Spring Boot 2.1.x
-            connectionHeaders = [StompCommands.commandHeaderAcceptVersion:"1.1,1.2"]
+            if (connectionHeaders == nil) {
+            	connectionHeaders = [StompCommands.commandHeaderAcceptVersion:"1.1,1.2"]
+            }
             // at the moment only anonymous logins
             self.sendFrame(command: StompCommands.commandConnect, header: connectionHeaders, body: nil)
         } else {