Skip to content

Touch App Loses Server Constantly

edited April 2018 in SecuritySpy
I have manually added my SecuritySpy Server to the iPhone app, but every time it loses connection (while changing from wifi to LTE for example) the app freaks out, throws an error message and the server is deleted. Is there a way to make it stop deleting the server? This is quite cumbersome because it's a long url a long username and a very long password. Sometimes even restarting the app causes the dreaded "Connection failed" error message and the server to be deleted. :(

Other than that, the app works great! (even through an nginx proxy with ssl)

Comments

  • This is not something we have heard about before! A temporary connection problem certainly shouldn't cause the server to be deleted from the app. Could you tell me exactly what this error message says? Does this happen when viewing live video for a particular camera, or on the first screen that show live video for all cameras, or some other screen in the app?

    Are you sure you are using the latest version of the app? Open App Store on your iPhone, search for SecuritySpy and see if there is an option to download the app.
  • I'll try to explain this behavior as best I can, but it's strange. I have a very custom setup, so I'm not hopeful of any immediate resolution. I've noticed now it saves the server, it just can never reconnect to it. I tried this on two iPhones with the latest Touch app. Here's what I'm doing:

    - On my nginx server, tail -f error and access logs (to make sure I didn't miss any paths and throw accidental 404s for security spy requests).
    - Phone is connected to LTE (same thing happens on wifi).
    - Click + icon. Enter fully qualified host name. port 443 user, password.
    - Click continue, and I immediately see all my cameras. I was blown away the first time I did this on LTE and it worked.
    I see log entries like this from nginx:
    107.77.211.96 - - [28/Apr/2018:16:43:23 -0700] "GET /++systemInfo HTTP/1.1" 400 272 "-" "SecuritySpyViewer/108"
    107.77.211.96 - - [28/Apr/2018:16:43:23 -0700] "GET /++systemInfo HTTP/1.1" 401 196 "-" "SecuritySpyViewer/108"
    107.77.211.96 - david [28/Apr/2018:16:43:23 -0700] "GET /++systemInfo HTTP/1.1" 200 1566 "-" "SecuritySpyViewer/108"
    107.77.211.96 - david [28/Apr/2018:16:43:24 -0700] "GET /++image?cameraNum=0&width=960 HTTP/1.1" 200 113941 "-" "SecuritySpyViewer/108"
    107.77.211.96 - david [28/Apr/2018:16:43:24 -0700] "GET /++image?cameraNum=2&width=960 HTTP/1.1" 200 117265 "-" "SecuritySpyViewer/108"
    107.77.211.96 - david [28/Apr/2018:16:43:24 -0700] "GET /++image?cameraNum=1&width=960 HTTP/1.1" 200 123970 "-" "SecuritySpyViewer/108"
    .... they go on as long as I look at this screen.

    - Double tap home button, swipe up on SecuritySpy to close it.
    - Open securityspy back up.
    - It spins for a while with my hostname in the top.
    - Nginx produces no logs, no new connections, no requests. SecuritySpy never tries to reconnect on port 443.
    - After 5-10 seconds: Connection Failed Unable to connect to the server.
    - Click OK.
    - I see my server is now saved, I click it. Same problem.
    - At this point if I click the + I can repeat the entire process.

    It feels like something is not being saved. Like the port. I could crack open tcpdump on my router to figure out if security spy is trying to hit another port. Lemme know if I can help figure this out.

    Thanks so much!
  • By any chance does this behavior change if you force the iPhone to connect via only cell data vs wifi?

    I had noticed some SS weirdness a while ago when my phone was allowed to switch network connections by itself.
  • For all intents and purposes, my server is exposed to the Internet with a public IP and a valid SSL certificate. Whether on Wifi or LTE my server's hostname resolves to the same public IP. The issue I'm having also happens when I use a private IP (forcing some DNS trickery at the network level). All I can assume is that the Touch app is not saving the port I'm specifying because after I close it, it never tries to connect again until I re-enter the server info.
  • Wasn't there a recent thread here where the solution complete deletion and reinstall of the IOS app. In that instance, the underlying issue seemed to be corruption of the stored settings that prevented proper saving of changes.
  • I've never had the app on any of my devices before the day I made this post. I've also tried several iDevices, some of which aren't mine. This is very reproducible.
  • Any chance your router is shifting the port numbers?
  • None whatsoever. Routers don't shift port numbers. External to my network my router forwards port 443 to my server; no shifting. Internal to my network, my router also forwards port 443 to my server. Accessing the server works great, through the Touch app or a web browser; on or off my network. I'm an Amazon Systems Engineer - networking is second nature.

    The only thing not working is: Once I add the server to the Touch app it cannot reconnect after disconnecting. Then I add the server again, it connects, works and continues working until it disconnects. The problem is that I have to re-type the hostname, port, username and password every time I want to look at cameras; it works fine, it just doesn't save the server in such a way that it's able to reconnect. Reproduced on multiple devices.

    It's a custom setup because I don't think SecuritySpy provides SSL natively; nginx is doing that for me. And that's all working.
  • edited May 2018
    OK. You had intimated that your network setup is unusual. I was asking in case your system has some obscure port translation system that is beyond the NAT the rest of us are familiar.

    You only have a couple possible problems from what I can understand.

    1. SS Touch App isn't storing the Port number between sessions (less likely because it SEEMS to save it for most of us)

    2. SS Touch isn't actually storing the port properly, but the rest of us are not noticing because we're using the default port that SS selects.

    3. Despite being a systems engineer, there is an errant rule in your firewall.

    4. The NGINX proxy is doing something bad to the connection. <--- I put my money here
  • 1. I assume most people don't put a port here. Maybe adding SSL to configuration makes the app choose code paths most people do not encounter.
    2. This is my gut feeling because nginx never records additional connections after the first one stops.
    3. Even without a firewall - changing dns to use a local IP - this happens.
    4. Good possibility, but nginx never receives a connection after the first one closes.

    I suppose I'm at the point of "go run tcpdump" to see what the phone is doing while it purports to be reconnecting. For now, I'm using a web browser to view my cameras.

    Thanks for your help!
  • edited May 2018
    Your TCP dump will be interesting.

    As for parameters not getting stored in prefs, we had a similar problem in our EHR app (~2,000 pages of source code) transitioning from 32-bit to 64-bit apps. An obscure line in preferences handler stopped handling inbound variants that were integers. Everywhere else integers going from 32 to 64 had been corrected. A quirk of syntax hid a Int32, Int64 mismatch. No integers were being properly stored, but were correctly read. Maybe something similar in SS?
  • This must be something to do with your unusual setup, but I'm not not what exactly this is yet.

    When you get it to the state where it can't connect, tap and hold on the server instance in the app. You should get a pop-up where it shows you what addresses it's attempting to use to connect to the server. Are the ones shown here correct or incorrect?
  • edited May 2018
    Nice trick Ben! The tcp port is not 443. It's reverted to 8001, my http port in security spy. it has the correct IP and hostname resolution, but port 8001 is firewalled off because it doesn't require authentication. I suppose my assumption that the port is not being saved was correct. Hope you can figure out what causes this. I'm quite willing to give you (Ben) access to my SecSpy instance; just let me know if you're interested in reproducing this yourself.
  • Sure hoping this can be fixed. :D
  • I have just setup nginx and it is working for all my services except SS. I am seeing exactly the same behaviour as above. I can create a new connection to SS and it works, port 443. SS is setup to use port 8000 non-SSL. Close the app and restart it, it fails to connect. Delete the connection and recreate it and it works again. Close the app, same issue. If I press and hold on my server name, it is trying to connect to port 8001 which I have not opened on my firewall.

    Any updates on how to fix this? Thanks
  • I don't even have to type in port 443 for it to work on the initial connection. I type in hostname, username and password, leaving port at automatic. It works. Then it just stops working after closing the app and saves the server with port 8001. Never to work again until I re-enter hostname, username and password. Usually by that time the motion I wanted to look at is gone.

    Can anyone recommend an alternative app that works with securityspy to view cameras remotely from a mobile device? (that doesn't require re-typing all the login credentials on every invocation?)
  • Hi @Ben

    Any chance of fixing this bug? plz plz plz - I really want to use this app, but it's just not convenient when I have to re-enter the login info every time I open it.
  • This certainly sounds like a bug. We'll look into this and hope to fix it in the next update. If we need access to your server we'll let you know (thanks for offering). For now I believe you will be able to fix this problem by reverting to SecuritySpy's standard ports (8000 for HTTP and 8001 for HTTPS).
  • SecuritySpy is actually using the standard port for http. I put nginx in front of it terminating SSL with a valid certificate. Everything works except the Touch app just loses the port 443.
  • Yes, what I mean is that you may be able to work around this by using 8001 as the WAN port for HTTPS, rather than 443, so that the iOS app is using 8001 to connect. This shouldn't be necessary, and we hope to be able to fix this in the next app update.
  • I'll pay for the app the moment you fix the bug preventing me from using it. :)
  • edited August 2022

    Curious if this bug ever got fixed. Related: https://bensoftware.com/forum/discussion/comment/11697#Comment_11697

  • The app has been updated since we had this discussion, and yes this problem should be fixed. It's much better now at using the correct ports and remember the user's input in addition to any auto-discovered ports.

  • Thanks! I'll try switching my port back now.

Sign In or Register to comment.