Turasa / libsignal-service-java

GNU General Public License v3.0
37 stars 21 forks source link

WebSocketConnection: Expected HTTP 101 but was 403 #8

Closed Trolldemorted closed 7 years ago

Trolldemorted commented 7 years ago

heyho,

i have rebased my multidevice branch of Signal-Android to the current head of master (here is the diff). I have installed libsignal-service-java from your current master with gradlew installArchives, and i have added the okhttp3 dependency to Signal-Android.

Now when signal is open, the log is flooded with this stracktrace:

01-27 23:56:13.471 7635-7941/org.thoughtcrime.securesms W/WebSocketConnection: WSC connect()...
01-27 23:56:13.999 7635-7976/org.thoughtcrime.securesms W/WebSocketConnection: onFailure()
01-27 23:56:14.000 7635-7976/org.thoughtcrime.securesms W/WebSocketConnection: java.net.ProtocolException: Expected HTTP 101 response but was '403 Unauthorized'
   at okhttp3.internal.ws.RealWebSocket.checkResponse(RealWebSocket.java:215)
   at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:182)
   at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
   at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
   at java.lang.Thread.run(Thread.java:818)
01-27 23:56:14.000 7635-7976/org.thoughtcrime.securesms W/WebSocketConnection: onClose()...

Any ideas? I have not intentionally changed anything that could have triggered this. Note that i can send and receive messages just fine ¯\_(ツ)_/¯

The urlrequest looks fine to me: https://textsecure-service.whispersystems.org/v1/websocket/?login=+49XXXXXXXXX&password=XXXXXXXXXXXXXXXXXXXXX

Turakar commented 7 years ago

Does this still happen if you re-register yourself? Did you try registration both as primary and secondary device?

Trolldemorted commented 7 years ago

Did not try it yet, so far i only tried to catch up with the latest version on my android slave.

Does it work for signal-cli slaves? Can signal-cli somehow output the verbose/debug level logs from its dependencies? I don't know whether my cli clients are falling back to the PushServiceSocket or not.

Nevertheless i'd like to avoid re-registering. since it is always a hassle with re-linking all slaves and it almost always produces session problems as contacts try to talk with new slaves using old sessions. If we could confine this to my account, i maybe should get into touch with moxie, as this starts to look like a signal-server issue to me.

Turakar commented 7 years ago

I currently do not have the necessary requirements to test this on my own.

Regarding your problem with re-registering: I would suggest to setup MultiROM on your device (you have to root your device for this. You might lose warranty during this, that depends on the company you bought the phone from.) and install a second ROM in parallel. This allows you to have both your "normal" version connected to the production server and a testing version connected to the staging server. There are also some App-Switchers and so on (you might be lucky with Titanium Backup), but I did not get them to work.

Another way to make re-registering cleaner is to delete your signal account using the options of the android app. However, you still have to be re-added to groups and your contacts have to accept your new safety numbers. I did not test this method a lot, so there might be some other traps.

Trolldemorted commented 7 years ago

My master device is a signal-cli client, it remembers groups and sessions, but linking slaves on different machines requires sending the tsdevice link to my pc at home.

In case it is a server bug i'd like to keep my account in that state though, so we can track it down.

@AsamK, could you check whether signal-cli slaves fall back to the push socket or not?