StompClientLib: Can't connect to websocket with authorization header
Hi. I get an error while trying to connect to websocket, here is the code:
let request = NSURLRequest(url: url)
socketClient.openSocketWithURLRequest(request: request, delegate: self, connectionHeaders:["Authorization": "Bearer \(token)"])
Response:
received bad response code from server 401
Do you have any ideas why that might be the case?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 21 (8 by maintainers)
@cedb777 @cleverClosure I also can not to send headers through connectionHeaders, but I send it in request, like this
For the ones who could not make it using headers on connection, try this, that approach works on my environment.
It worked for me with this code: ` let url = URL(string: “wss://(defaultSocketBase)/push?access_token=(token)”)!