forresthopkinsa/StompProtocolAndroid

Server Not Connected

Vijay-Thalapathy opened this issue · 1 comments

E/TAG: Error
java.lang.Exception: java.net.ProtocolException: Expected HTTP 101 response but was '401 '
at ua.naiksoftware.stomp.OkHttpConnectionProvider$1.onFailure(OkHttpConnectionProvider.java:83)
at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.kt:592)
at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:174)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.net.ProtocolException: Expected HTTP 101 response but was '401 '
at okhttp3.internal.ws.RealWebSocket.checkUpgradeSuccess$okhttp(RealWebSocket.kt:224)
at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:170)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:919) 

Can you specify how to add authentication header in your library for connecting the websocket URL So
I'm currently facing this issue from your library kindly check out this issue get back to me as soon as possible.

This is because of the error in the documentation you need to define your endpoint like this ws://YOUR_IP:PORT/socket-example/websocket

2 key things here:

  • you need ws://
  • you need /websocket at the end

Check out this link for more information.