iOS Secure WebSocket Connection Timing Out & Map Sync Issues with Custom SSL Server

Hello, all,

I'm new to iOS development and working on a project with the following setup:

Architecture:

  • Windows PC running Ubuntu (WSL) hosting a WebSocket Server with self-signed SSL
  • Python GUI application as a client to control iOS app
  • iOS app as another client on physical iPhone
  • Server running on wss://***.***.***.1:8001 (this is the mobile hotspot IP from Windows PC which the iPhone is needed to connect to as well)

Current Status:

  • ✓ Server successfully created and running
  • ✓ Python GUI connects and functions properly
  • ✓ iOS app initially connects and communicates for 30 seconds
  • ✗ iOS connection times out after 30 seconds
  • ✗ Map updates from GUI don't sync to iOS app

Error Message in Xcode terminal:

WebSocket: Received text message
2024-11-25 15:49:03.678384-0800 iVEERS[1465:454666] Task <CD21B8AD-86D9-4984-8C48-8665CD069CC6>.<1> finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2103, _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <CD21B8AD-86D9-4984-8C48-8665CD069CC6>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <CD21B8AD-86D9-4984-8C48-8665CD069CC6>.<1>"
), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=wss://***.***.***.1:8001/, NSErrorFailingURLKey=wss://***.***.***.1:8001/, _kCFStreamErrorDomainKey=4}

Technical Details:

  • Using iOS built-in URLSessionWebSocketTask for WebSocket connection
  • Self-signed SSL certificate
  • Transport security settings configured in Info.plist
  • Map updates use base64 encoded PNG data

Questions:

  1. What's causing the timeout after 30 seconds?
  2. How can I maintain a persistent WebSocket connection?
  3. Why aren't map updates propagating to the iOS client?

Any guidance/suggestions would be greatly appreciated. Please let me know if additional code snippets would help on what I currently have.

iOS Secure WebSocket Connection Timing Out &amp; Map Sync Issues with Custom SSL Server
 
 
Q