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

mobile frontend socket timeouts #48

Closed
thexperiments opened this issue Feb 3, 2014 · 19 comments
Closed

mobile frontend socket timeouts #48

thexperiments opened this issue Feb 3, 2014 · 19 comments

Comments

@thexperiments
Copy link
Contributor

I have just tried to connect to pimatic mobile frontend via a slow mobile connection from my smartphone and it took many tries to connect the socket. The screen was changing from "could not connect, retrying..." to "connecting" several times then the login screen appears. As soon as it has managed to connect it works quite fast. Maybe the timeouts should be configurable within settings.

@thexperiments
Copy link
Contributor Author

warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized v1zOA_49GJPBvSGuWRBh(this is when i finally get the login prompt)

iPhone 5 with ios7 and mobile safari ofer LTE

@sweetpi
Copy link
Contributor

sweetpi commented Feb 3, 2014

Strange, with latest released version the timeout is at 20 seconds. So probably it was the mobile connection that was dropping and not the connection that timed out. However I will add a option for it.

@sweetpi sweetpi added the todo label Feb 3, 2014
@sweetpi
Copy link
Contributor

sweetpi commented Feb 3, 2014

warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized v1zOA_49GJPBvSGuWRBh(this is when i finally get the login prompt)

The warnings are ok, socket.io is just a little to verbose. It seems to be realy the connection thats dropping not the timeout

@thexperiments
Copy link
Contributor Author

could also be a problem with heartbeat timeout, see:
socketio/socket.io#777

@thexperiments
Copy link
Contributor Author

info: socket.io: handshake authorized vi23oOpvqaeg1QwDD1zN
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized rdWgbksPEOmJ0dWSD1zO
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized SNOkfiOI_eJ40PQoD1zP
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized IAsw3fTRGGNWAKmtD1zQ
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized N0QJBHnp-OVLM6J4D1zR
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized qbEZ_LwDwPFs68yoD1zS
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized dWOGbz9ilsuWiL2dD1zT
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized 4iT_zeLg9RxwcTj8D1zU
info: socket.io: transport end (close timeout)
info: socket.io: transport end (close timeout)
info: socket.io: transport end (close timeout)
info: socket.io: transport end (close timeout)

that is the log of one reconnect

Am 03.02.2014 um 22:46 schrieb sweetpi notifications@github.com:

warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
warn: socket.io: websocket connection invalid
info: socket.io: transport end (undefined)
info: socket.io: handshake authorized v1zOA_49GJPBvSGuWRBh(this is when i finally get the login prompt)

The warnings are ok, socket.io is just a little to verbose. It seems to be realy the connection thats dropping not the timeout


Reply to this email directly or view it on GitHub.

@thexperiments
Copy link
Contributor Author

onConnectionError = ->
    pimatic.loading "socket", "show",
      text: __("could not connect, retying")
      textVisible: true
      textonly: false
    setTimeout ->
      pimatic.socket.socket.connect()
    , 2000

  pimatic.socket.on 'error', onConnectionError
  pimatic.socket.on 'connect_error', onConnectionError

could we maybe get more info on the kind of error here?

@sweetpi
Copy link
Contributor

sweetpi commented Feb 4, 2014

you can display the error with pimatic.showToast.

@sweetpi sweetpi added bug and removed enhancement labels Feb 4, 2014
@sweetpi
Copy link
Contributor

sweetpi commented Feb 4, 2014

It looks like socket.io doesn't expose a error.
https://github.com/LearnBoost/socket.io/wiki/Exposed-events

@sweetpi
Copy link
Contributor

sweetpi commented Feb 4, 2014

could also be a problem with heartbeat timeout, see:
socketio/socket.io#777

seems to be that. Could you try the mention fix attempt?

@thexperiments
Copy link
Contributor Author

But it exposes errors on client side which we not yet fully log/print.

Have tried the Fix with setting a high heartbeat timeout, didn't work but I expected that. Also tried to increase the timeout for the first connection attempt (500ms) but it did not help.

It really looks like the connection is dropping, maybe I find some time to look at it with a packet analyzer.

The heartbeat didn't really make sense because connection was not dropping once successfully connected but only on the first connection attempts.

Like this:
7x the following:
1 second: connecting...
2 seconds: could not connect... reconnecting
then the login form pops up and after logging in everything works

@thexperiments
Copy link
Contributor Author

Just found this:
https://stackoverflow.com/questions/5557776/websockets-over-a-3g-connection

could verry well be the problem! Damn T-mobile

@thexperiments
Copy link
Contributor Author

SSL would help :) the can not prox it :D, will set it up soon

@sweetpi
Copy link
Contributor

sweetpi commented Feb 6, 2014

strange. The bug seems to be iphone related. I don't experimenced that on android...

@sweetpi
Copy link
Contributor

sweetpi commented Feb 6, 2014

SSL would help :) the can not prox it :D, will set it up soon

You should anyway :)

@elektronaut69
Copy link

I do not expose my RPI to the internet. I use VPN to access it remotely. This is secure and works like a charm.

sweetpi notifications@github.com schrieb am 06.02.2014:

SSL would help :) the can not prox it :D, will set it up soon

You should anyway :)


Reply to this email directly or view it on GitHub:
#48 (comment)

@sweetpi
Copy link
Contributor

sweetpi commented Feb 6, 2014

sounds good :). Hm but than T-mobile can't touch you connections or am I wrong..

@elektronaut69
Copy link

You're right. It's like being logged in locally. With my fritzbox it is very easy to set up.

sweetpi notifications@github.com schrieb am 06.02.2014:

sounds good :). Hm but than T-mobile can't touch you connections or am
I wrong..


Reply to this email directly or view it on GitHub:
#48 (comment)

@thexperiments
Copy link
Contributor Author

I will set SSL up for sure, currently only test setup. Your android would
have the same problems without the vpn tunnel i guess, for sure t-mobile
cant manipulate what is going through vpn.

I don't like the vpn approach for some reasons:

  1. I would need to activate the vpn everytime I want to control something
  2. I would not have the ability to connect from a pc without installing
    some VPN client
  3. My Router does not support such an easy setup
  4. SSL done correctly is just as secure

2014-02-06 elektronaut69 notifications@github.com:

You're right. It's like being logged in locally. With my fritzbox it is
very easy to set up.

sweetpi notifications@github.com schrieb am 06.02.2014:

sounds good :). Hm but than T-mobile can't touch you connections or am
I wrong..


Reply to this email directly or view it on GitHub:
#48 (comment)

Reply to this email directly or view it on GitHubhttps://github.com//issues/48#issuecomment-34342038
.

@sweetpi sweetpi added invalid and removed todo labels Feb 7, 2014
@sweetpi
Copy link
Contributor

sweetpi commented Feb 7, 2014

I don't like the vpn approach for some reasons:

  1. I would need to activate the vpn everytime I want to control something
  2. I would not have the ability to connect from a pc without installing
    some VPN client
  3. My Router does not support such an easy setup
  4. SSL done correctly is just as secure

Fully aggree. So I close this. If the problem still exists with SSL please repopen it.

@sweetpi sweetpi closed this as completed Feb 7, 2014
@sweetpi sweetpi removed the Q&A label Apr 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants