GithubHelp home page GithubHelp logo

Comments (21)

iOSDias avatar iOSDias commented on July 17, 2024 3

@cedb777 @cleverClosure
I also can not to send headers through connectionHeaders, but I send it in request, like this

    var socketRequest: NSURLRequest {
        let webSocket = URL(string: urlString)!
        var request = URLRequest(url: webSocket)
            request.setValue(("Bearer " + token).toBase64, forHTTPHeaderField: "Authorization")
        return request as NSURLRequest
    }

from stompclientlib.

cleverClosure avatar cleverClosure commented on July 17, 2024 1

It worked for me with this code:
` let url = URL(string: "wss://(defaultSocketBase)/push?access_token=(token)")!

    let request = NSURLRequest(url: url)

    let headers: [String: String] = ["heart-beat": "20,20"]

    socketClient.openSocketWithURLRequest(request: request, delegate: self, connectionHeaders: headers)`

from stompclientlib.

jbarros35 avatar jbarros35 commented on July 17, 2024 1

@cedb777 @cleverClosure
I also can not to send headers through connectionHeaders, but I send it in request, like this

    var socketRequest: NSURLRequest {
        let webSocket = URL(string: urlString)!
        var request = URLRequest(url: webSocket)
            request.setValue(("Bearer " + token).toBase64, forHTTPHeaderField: "Authorization")
        return request as NSURLRequest
    }

For the ones who could not make it using headers on connection, try this, that approach works on my environment.

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

Hello @cleverClosure ,
I need an example to test it out. Can you provide it?

from stompclientlib.

cleverClosure avatar cleverClosure commented on July 17, 2024

Can I send it to you privately somehow? I don't want the url to be public

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

You can send me an email : [email protected]

from stompclientlib.

cleverClosure avatar cleverClosure commented on July 17, 2024

I've sent you an email

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

Hello again @cleverClosure,
As I mentioned on the mail, I got this error from your server:
didFailWithError: Optional(Error Domain=SRWebSocketErrorDomain Code=2133 "Invalid Sec-WebSocket-Accept response" UserInfo={NSLocalizedDescription=Invalid Sec-WebSocket-Accept response})

Can you provide a working authentication token or please check your server part :)

from stompclientlib.

cleverClosure avatar cleverClosure commented on July 17, 2024

Yes, that is exactly what I get when I use ws instead of wss or https. Here is the new token: 451ac7a5-ad93-4859-8c62-b41e96d6a34d

from stompclientlib.

cleverClosure avatar cleverClosure commented on July 17, 2024

The server side works, because I am able to connect to it from the web client

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

@cleverClosure
Have you checked these issues?
#30 and #32 ?

from stompclientlib.

cleverClosure avatar cleverClosure commented on July 17, 2024

The webserver works on sockJS but adding /websocket to the url didn't help

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

@cleverClosure I'm really sorry but I could not find the problem about your issue :(
I've tried another websocket with authentication and it works without any issue. I have only left is that your websocket backend might have an issue about it.

from stompclientlib.

cleverClosure avatar cleverClosure commented on July 17, 2024

Can I ask you which websocket with auth did you try (the one you were able to connect successfully)? Is that local webserver or something?

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

I've tried on a very simple local webserver. Unfortunately, I do not have any other options.

from stompclientlib.

said13 avatar said13 commented on July 17, 2024

Someone solved this problem?
I have the same issue.

from stompclientlib.

cedb777 avatar cedb777 commented on July 17, 2024

Same issue! Someone solved this ?

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

@said13 and @cedb777, Can you guys provide me with an example of the issue? Because I could not reproduce it on my own simple WebSocket server.

from stompclientlib.

said13 avatar said13 commented on July 17, 2024

@iOSDias Hi! It works?

from stompclientlib.

iOSDias avatar iOSDias commented on July 17, 2024

@said13 yes

from stompclientlib.

WrathChaos avatar WrathChaos commented on July 17, 2024

Finally, I closed the issue :) Please open a new one if you still have a problem.

from stompclientlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.