RocketChat / Rocket.Chat.Cordova

Rocket.Chat Cross-Platform Mobile Application via Cordova (DEPRECATED)
MIT License
104 stars 109 forks source link

Stuck on 'Waiting for server connection' #108

Open dblessing opened 8 years ago

dblessing commented 8 years ago

Potentially at some point in the past I entered an incorrect server URL in the iOS app. Now when I open Rocket Chat I get a screen with a white bar in the middle and the 'Waiting for server connection' at the top with an exponential back off for reconnecting.

There is no way I can see to stop this action and get back to where I can enter a proper URL. I've even tried killing the app and re-opening but I'm still stuck in this limbo.

cc/ @engelgabriel

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

engelgabriel commented 8 years ago

Can you delete the app and install again? Not ideal.. but just a quick fix for now.

dblessing commented 8 years ago

That works. Thanks @engelgabriel

123Haynes commented 8 years ago

I had the same issue with the android app.

andricicezar commented 8 years ago

I have same issue entering a local IP address.

venkat001 commented 8 years ago

I also have same problem. Could anyone find the solutions. Share it.

g0ldstrike commented 8 years ago

Same here. Reinstalling Android app and emptying cache doesn't help. Also noticed that from the same device, connecting to the server by using the browser works fine. Local or global IP give exact same issues.

When I debug the app in Android Studio, I see these two lines repeating with a different code behind cb=:

V/meteor.cordova.updater: remapUri http://10.0.2.2/sockjs/info?cb=cnf877o23k
D/meteor.cordova.updater: Host is not intercepted: 10.0.2.2

Update: I figured out that the problem is located at the server you're trying to connect to, rather than the app, because the issue does not occur when I connect my app to https://demo.rocket.chat

Is this related to the warning on this repo's readme: 'This application only connects with servers that were compiled with mobile platforms enabled' ?

mlanner commented 8 years ago

Seeing the same issue. I'm running the snap installed version of Rocket.Chat.

g0ldstrike commented 8 years ago

Solved the problem. This happens when the Site URL is configured incorrectly.

The docs state the following:

You MUST set the ROOT_URL environment variable to the Internet accessible URL to your server.

When you have not changed the Site URL before, it will be equal to the value you set as ROOT_URL. However, when installing a snap instance (@mlanner), ROOT_VALUE is not configurable and will be http://localhost . Therefore, you need to change the Site URL to the URL that another device can reach:

LAN: http://192.168.X.XX:3000

Internet: http://<your_internet_ip>:<public_port>

... or whatever IP and port you configured

You can set the Site URL as an administrator user in the UI: Administration -> General -> Site URL Make sure to save the changes and restart the server.

dbanet commented 7 years ago

My ROOT_URL is set correctly and Internet accessible, however I still have the problem.

Yyyup, as per @g0ldstrike, you also need to set it correctly in the Administration UI. Am too blind for this shit, sorry.

nicolas59 commented 7 years ago

I use rocket chat with the url https://my domain>/rocket. Is the mobile application can support an url which is not the root path ?

apoikola commented 7 years ago

I had a similar problem:

-> Installed the Rocket Chat Andoid App from Google Play -> Inserted possibly wrong server URL on first time -> get "301 moved permanently nginx/1.10.2" white page -> with back button I can see a 0.2 second glimpse of the set server url page, and then the app tries to connect again and to same wrong url automatically -> Uninstall the app, clear cache -> problem remains... magically it remembers the old wrong address

Finally I figured out that I had to go and delete all application data (clear cache is not enough) from the App settings for the Rocket Chat and then re-start.

So Uninstalling did not delete the data...!

To be able to close this issue I think there should be added some way to simply go and change the server via the UI also after the first (possibly wrong address) attempt.

geekgonecrazy commented 7 years ago

In the future if you do a two finger swipe up you can add or delete servers. But yes we should probably follow a redirect.

takigama commented 7 years ago

Im stuck with this problem as well and it seems the client (at least on android and ipohne) cant handle the subdirectory on the url... i.e. my rocket chat server is on https://xxxx.yyyy.com.au/rc/..

Other clients seem just fine as does the web browser. Also not sure whether i should be raising it as an issue here or against the android client (url is set correctly in the gui and in the environment and have tied both https://my.dom/rc and https://my.com/rc/)

With the android client, and watchng adb, i eventually get an error that looks like this:

10-10 14:56:12.134 2331 2331 I chromium: [INFO:CONSOLE(0)] "XMLHttpRequest cannot load https://x.abc.com.au/sockjs/info?cb=jt3n5tgdeb. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://httpsxabccomaurc.meteor.local' is therefore not allowed access. The response had HTTP status code 404.", source: http://httpsxabccomaurc.meteor.local/rc/home (0)

Dont know where its getting "http://httpsxabccomaurc.meteor.local" from, tho it looks like its just removed all punctuation from the original url... .not sure if this is an error or not

And prior to tht at i see this:

10-10 14:56:12.044 4199 4899 D InputMethodManagerService: mDesktopModeManager null! 10-10 14:56:12.044 4199 4899 V InputMethodManagerService: hideCurrentInputLocked - !shouldHideSoftInput 10-10 14:56:12.045 2331 2331 D cr_Ime : [ImeAdapter.java:553] focusedNodeChanged: isEditable [false] 10-10 14:56:12.051 2331 2386 V meteor.cordova.updater: remapUri https://x.abc.com.au/sockjs/info?cb=jt3n5tgdeb 10-10 14:56:12.052 2331 2386 D meteor.cordova.updater: Host is not intercepted: x.yyy.com.au

Watching the web logs i can see it run off and get a bunch of files after putting in the url (in which it gets the right url) and once its finished "downloading files" and should redirect back to the login - thats where it starts trying to use /sockjs rather then /rc/sockjs.

as my rocket chat server is behind a nginx ssl proxy, i tried mapping /sockjs to /rc/sockjs which "sort of" works, but theres other odd broken behaviour happening in there as well.

From what i've read running in a sub directory shouldn't be an issue (https://rocket.chat/docs/installation/manual-installation/running-in-a-sub-folder and others)

Have also tried to do this without the nginx proxy and accessing directly without any luck so far.

playpeace commented 6 years ago

Anyone has any update on the what @takigama posted?

I am running rocket chat on a sub directory using nginx and it works alright via web interface. (Not SSL )

When I try via the android app (with the name RocketChat), it gets stuck after downloading files with "Waiting for server connection".

Should be okay as per this-> https://rocket.chat/docs/installation/manual-installation/running-in-a-sub-folder.

Do we need to add something to nginx as is described for apache in the above link when run under a (Other than https://rocket.chat/docs/installation/manual-installation/configuring-ssl-reverse-proxy/ , not on SSL so removed that part.)

@takigama Were you able to find a solution to this? I have run into the exact same issue with rocket chat being behind nginx (not ssl though). It finishes download, then tries to use /sockjs instead of /sockjs and its stuck.

jetskijoe commented 6 years ago

@playpeace I am running into the same issue it is appending the .metero.local on mine also. Please let me know if you found a solution.

playpeace commented 6 years ago

@jetskijoe I did find a workaround solution.

There were two problems. 1) Http to websocket upgrade 2) Rocket Chat not able to handle sub-directories. I am hosting Rocket.Chat at mydomain.com/chat . ( There is already captured that it is not supported here https://github.com/RocketChat/Rocket.Chat.Android/issues/617)

The requests were made to /sockjs/ instead of /chat/sockjs/ . I just added a new rule to do this:

    location ^~ /sockjs/ {

    rewrite ^/sockjs/(.*)$ /chat/sockjs/$1 break;

    proxy_pass http://127.0.0.1:<port>/chat/;

    <UPGRADE STUFF>

and it worked. Hope this helps.

sailfish009 commented 4 years ago

same issue here, try to restart rocket chat.

sudo systemctl restart rocketchat