Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Sec-WebSocket-Accept response #32

Closed
lithinJames opened this issue Dec 6, 2018 · 11 comments
Closed

Invalid Sec-WebSocket-Accept response #32

lithinJames opened this issue Dec 6, 2018 · 11 comments

Comments

@lithinJames
Copy link

Hi I’m getting "Invalid Sec-WebSocket-Accept response” error when connect to websocket server developed in java spring boot. Java client is able to successfully connect and send message,

Below is our code implementation

import StompClientLib

   var socketClient = StompClientLib()
    let completedWSURL = "ws://192.168.1.37:8080/iostest/chat"
     let Request = NSMutableURLRequest(url: NSURL(string:completedWSURL)! as URL)
    socketClient.openSocketWithURLRequest(request:Request, delegate: self as        StompClientLibDelegate)

Error response is
Error Domain=SRWebSocketErrorDomain Code=2133 "Invalid Sec-WebSocket-Accept response" UserInfo={NSLocalizedDescription=Invalid Sec-WebSocket-Accept response}

Any help is much appreciated. Thanks in advance.

@tuluigi
Copy link

tuluigi commented Dec 20, 2018

@lithinJames
you are using a SockJS server; by changing this
"ws://192.168.1.37:8080/iostest/chat"
to
"ws://192.168.1.37:8080/iostest/chat/websocket"

@WrathChaos
Copy link
Owner

Hello @lithinJames,
Firstly, Thank you for the answer @tuluigi.
Is that work for you @lithinJames ? If it is not working, please re-open the issue :)

@said13
Copy link

said13 commented May 18, 2019

@tuluigi Hi! Can you please tell why should adding “/websocket” solve the issue?
I also have sockJs server and also have this issue.

@reallyram
Copy link

Thanks @tuluigi

@Shankar105
Copy link

Shankar105 commented Jun 24, 2020

@WrathChaos Hi, I am also getting the same error.

(Error Domain=SRWebSocketErrorDomain Code=2133 "Invalid Sec-WebSocket-Accept response" UserInfo={NSLocalizedDescription=Invalid Sec-WebSocket-Accept response})

@WrathChaos
Copy link
Owner

Hello @Shankar105,
Have you checked this issue and tried the solutions?

@Shankar105
Copy link

@WrathChaos , Thanks you for your quick response. it was a problem with the server side code.

@WrathChaos
Copy link
Owner

@WrathChaos , Thanks you for your quick response. it was a problem with the server side code.

Did you fix it? If you fixed it please share with us then people who have this problem can find it and solve it easily :)

@smoralesVLL
Copy link

Same problem here. Can you share with us the solution?

@zahidshaikh795
Copy link

zahidshaikh795 commented Aug 31, 2022

func registerSocket(){
        let completedWSURL  = "ws://cepqa.vecv.net/live/vehicle-live-tracking"
        url = NSURL(string: completedWSURL)!
        socketClient.openSocketWithURLRequest(request: NSURLRequest(url: url as URL) , delegate: self as StompClientLibDelegate)
    }

I am also facing the same issue "invalid sec-websocket-accept response".
Earlier i was using "ws://169.38.69.67:8080/live//vehicle-live-tracking" and it was working fine and connection established but since I change to "ws://cepqa.vecv.net/live/vehicle-live-tracking", I keeps geeting this error.

@dangnguyen1004
Copy link

@lithinJames you are using a SockJS server; by changing this "ws://192.168.1.37:8080/iostest/chat" to "ws://192.168.1.37:8080/iostest/chat/websocket"

Amazing, Thanks @tuluigi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants