WrathChaos/StompClientLib

Cannot connect with Stomp Websocket when custom header

baonguyena1 opened this issue · 3 comments

Hi Guy,

In the latest version(1.3.6) I see the Library is supporting spring-boot 2.1.x by code:

        if (connectionHeaders == nil) {
        	connectionHeaders = [StompCommands.commandHeaderAcceptVersion:"1.1,1.2"]
        }

But in case I connect with socket with the custom header by function public func openSocketWithURLRequest(request: NSURLRequest, delegate: StompClientLibDelegate, connectionHeaders: [String: String]?). That means the connectionHeaders is not null, so the connectionHeaders cannot add an accepted version by your code. So I think for fix this, you can add accepted version instance of replace connectionHeaders, like

if (connectionHeaders == nil) {
connectionHeaders = [StompCommands.commandHeaderAcceptVersion:"1.1,1.2"]
} else {
connectionHeaders?[StompCommands.commandHeaderAcceptVersion] = "1.1,1.2"
}

Hello @baonguyena1,
Can you please open a PR for this fix? :)

@WrathChaos I will do it.

Done with this release : 1.3.5+