forresthopkinsa / StompProtocolAndroid

Websockets on Android
MIT License
11 stars 4 forks source link

Server Not Connected #13

Open Vijay-Thalapathy opened 3 years ago

Vijay-Thalapathy commented 3 years ago

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.

UPocek commented 1 year ago

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:

Check out this link for more information.