0

So... i've been having great fun creating a websocket app in/for Wrench. It seems Wrench itself is pretty robust(for it's simplicity)? Seemed like the best option for the PHP language after getting feedback here.

The problem I have is that Mobile Phones using Cellular connection can't connect to the websocket in the first place. And when using WiFi on the Phone it connects, but if i turn wifi off and let the cellular connection take over, it disconnects and eventually crashes the Server due to not being able to find the connection (it seems the default server doesn't handle this disconnect well).

It also crashes the server if I connect on the phone with WiFi but then let the browser sit in the background and not do anything for a while.

Some of the Wrench Error msg:

Fatal error: Uncaught exception 'Wrench\Exception\SocketException' with message 'Cannot get socket IP address' in /***/Wrench/lib/Wrench/Socket/Socket.php:156

Fatal error: Uncaught exception 'Wrench\Exception\ConnectionException' with message 'Could not send data to connection: Unknown error' in /***/Wrench/lib/Wrench/Connection.php:379

I'm sure i can add code to stop the server from crashing in those circumstances, and even stop mobile users( with wifi) from getting a connection in the first place, but i would really like to get them to connect...

Is it possible to have mobile users with cellular connection connect to Wrench Websockets? If so, how? Configure the Server Script? Or is it a Hosting issue?

Thanks

Matt
  • 278
  • 3
  • 12
  • `Cannot get socket IP address` sounds like your connection isn't actually open ( https://github.com/varspool/Wrench/blob/master/lib/Wrench/Socket/Socket.php#L156 ). – WWW Sep 21 '15 at 13:13
  • I looked at that code you linked before - couldn't make much sense of it in terms of my problem. I've had the server run for weeks on end on my test server without a restart. It's not until I've shown a friend on an android phone with WiFi connection that i noticed it crashed shortly afterwards, after the WiFi was disconnected. – Matt Sep 21 '15 at 13:19
  • Your websocket won't live through connection changes - if the phone switched from cellular data to WiFi and back, it's not going to maintain the connection through those switches. Yes, it's possible to use websockets over cellular, but you're at the behest of the quality of the cellular connection. – WWW Sep 21 '15 at 13:47
  • hmm Interesting, thanks for that info. But why is it that i can't connect to the websocket via cellular connection in the first place? Is that a websocket limitation, browser limitation, or a server limitation (maybe my server is just configured wrong?) – Matt Sep 21 '15 at 15:28
  • Maybe the cell carrier is firewalling the network connection of the phone? I don't think you have enough information about the problem to make a definite diagnosis as to why it's happening. – WWW Sep 21 '15 at 15:51
  • Thanks for the feedback - I run the Wrench server on port 8000 - i opened the port on the server. Thats about all i did to accommodate Wrench/websockets on my server. I was hoping someone would hop on and say "you big dummy, you need to config this and that and it will work" .. :-). What i'm unsure about is.. is Cellular connections to a Wrench server supposed to work, or is it known that it doesn't work? – Matt Sep 21 '15 at 16:51
  • 1
    http://stackoverflow.com/questions/5557776/websockets-over-a-3g-connection - so it may be on the carrier. My organization stopped using websockets and replaced them with timed polling and long polling, though I don't remember running into any issues with websockets over AT&T's cellular internet. – WWW Sep 21 '15 at 18:37
  • Thank you Crontab - seems that i'm trying to do the impossible. Now i'm no longer worried i was doing something wrong and i guess i'll just have to preclude mobile connections. – Matt Sep 21 '15 at 20:09

0 Answers0