React Native - iOS Real Device - Socket IO Web Sockets not Working - ios

I have ran into an issue with socket events not hitting the server. I have an application that uses SocketIO. The application works great when I use iOS Simulator. As soon as I try to run my app on a real device socket events are not hitting the server. This is the case in both localhost and the instance located on AWS.
When I press a button that should send a socket event to the server I get nothing in the console in Xcode. The only thing I can see is an initial error that seems to happen continuously as soon as the application is built and launched.
2019-01-30 07:12:38.533860-0800 Moder8[1033:191786] [] nw_socket_handle_socket_event [C512.1:1] Socket SO_ERROR [61: Connection refused]
2019-01-30 07:12:38.536864-0800 Moder8[1033:191786] [] nw_socket_connect [C512.2:1] connectx(7, [srcif=0, srcaddr=<NULL>, dstaddr=::1.8097], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [61: Connection refused]
2019-01-30 07:12:38.537119-0800 Moder8[1033:191786] [] nw_socket_connect [C512.2:1] connectx failed (fd 7) [61: Connection refused]
2019-01-30 07:12:38.537176-0800 Moder8[1033:191786] [] nw_socket_connect connectx failed (fd 7) [61: Connection refused]
2019-01-30 07:12:38.538112-0800 Moder8[1033:190902] [] nw_connection_get_connected_socket [C512] Client called nw_connection_get_connected_socket on unconnected nw_connection
2019-01-30 07:12:38.538230-0800 Moder8[1033:190902] TCP Conn 0x282234840 Failed : error 0:61 [61]
2019-01-30 07:12:40.115642-0800 Moder8[1033:191786] [] nw_socket_handle_socket_event [C513.1:1] Socket SO_ERROR [61: Connection refused]
2019-01-30 07:12:40.115716-0800 Moder8[1033:191786] [] nw_socket_handle_socket_event [C514.1:1] Socket SO_ERROR [61: Connection refused]
2019-01-30 07:12:40.116498-0800 Moder8[1033:191786] [] nw_socket_handle_socket_event [C513.2:1] Socket SO_ERROR [61: Connection refused]
2019-01-30 07:12:40.116561-0800 Moder8[1033:191786] [] nw_socket_handle_socket_event [C514.2:1] Socket SO_ERROR [61: Connection refused]
2019-01-30 07:12:40.116698-0800 Moder8[1033:190953] [] nw_connection_get_connected_socket [C513] Client called nw_connection_get_connected_socket on unconnected nw_connection
2019-01-30 07:12:40.116715-0800 Moder8[1033:190953] TCP Conn 0x28221d380 Failed : error 0:61 [61]
2019-01-30 07:12:40.116755-0800 Moder8[1033:190953] [] nw_connection_get_connected_socket [C514] Client called nw_connection_get_connected_socket on unconnected nw_connection
2019-01-30 07:12:40.116768-0800 Moder8[1033:190953] TCP Conn 0x28221d2c0 Failed : error 0:61 [61]
The reason I am skeptical as to whether this has anything to do with the problem is because I get this same error when I use the Simulator and the socket events reach the server just fine.
What I have done.
I have searched Google and have read many references to related stuff including:
React native socket io no events being emitted from client
Getting "socket.error: [Errno 61] Connection refused" python paramiko
https://medium.com/#hr.hseyin_80381/8-steps-to-get-rid-of-error-nw-connection-get-connected-socket-connection-has-no-connected-handler-1bf622ca2332
Can't connect to web socket react-native-meteor iOS
I almost feel like this is something ridiculously simple. I tried playing around with App Transport Security Settings but could not find anything that made a difference:

I figured out the problem. iOS requires you to use the Mac IP address when connecting to localhost. I forgot to add my socket url into the env config file so it was pointing at localhost which obviously will not work for the localhost server instance or the one on AWS.

Related

URLSession webSocketTask is aborted after background mode

In my project I have URLSession.shared.webSocketTask(with: url) to listen to incoming updates from the server. When I hide and open the app again (I guess enter background mode) the socket connection is aborted and I get following errors:
2023-02-17 16:50:58.147335+0100 App[6057:327579] [connection] nw_read_request_report [C2] Receive failed with error "Software caused connection abort"
2023-02-17 16:50:58.147546+0100 App[6057:327579] [connection] nw_read_request_report [C1] Receive failed with error "Software caused connection abort"
2023-02-17 16:50:58.149527+0100 App[6057:327578] [websocket] Read completed with an error Software caused connection abort
2023-02-17 16:50:58.150047+0100 App[6057:327578] Task <5BFFE42D-3DC8-4B1F-BFB9-8E7985D588DF>.<1> finished with error [53] Error Domain=kNWErrorDomainPOSIX Code=53 "Software caused connection abort" UserInfo={NSDescription=Software caused connection abort, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalWebSocketTask <5BFFE42D-3DC8-4B1F-BFB9-8E7985D588DF>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <5BFFE42D-3DC8-4B1F-BFB9-8E7985D588DF>.<1>}
2023-02-17 16:50:58.152318+0100 App[6057:327579] [connection] nw_flow_add_write_request [C1 18.66.192.38:443 failed parent-flow (satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns)] cannot accept write requests
2023-02-17 16:50:58.152392+0100 App[6057:327579] [connection] nw_write_request_report [C1] Send failed with error "Socket is not connected"
16:50:58 [LOG] error: Error Domain=kNWErrorDomainPOSIX Code=53 "Software caused connection abort" UserInfo={NSDescription=Software caused connection abort}
So it seems like the system drops my socket connections since the file system is not writeable anymore. I already tried some solutions from the internet like:
let config = URLSessionConfiguration.default
config.waitsForConnectivity = true
config.shouldUseExtendedBackgroundIdleMode = true
let session = URLSession(configuration: config, delegate: self, delegateQueue: nil)
but still have the same issue.
Using URLSessionConfiguration.background(withIdentifier: "example") also does not help, it crashes with an error: WebSocket tasks are not supported in background sessions.
I guess the only strait forward solution is just to request a new session after the error occurs. But I believe there is a better setup for that. Does anyone know?

onesignal in ios for react native

I am getting error while debugingios log
[connection] nw_socket_handle_socket_event [C94.1.2:1] Socket SO_ERROR [61: Connection refused]
[connection] nw_connection_get_connected_socket_block_invoke [C94] Client called nw_connection_get_connected_socket on unconnected nw_connection
TCP Conn 0x6000014c4500 Failed : error 0:61 [61]
I follow below link for setting onesignal in ios for react native but it's not woking.
however, it's working fine in android.
https://blog.logrocket.com/implement-push-notifications-react-native-onesignal/
https://documentation.onesignal.com/docs/react-native-sdk-setup
This is something else issue.
Please run on your real iPhone device

MultipeerConnectivity can't invite peer

I am trying to make an ios app and an osx app communicate between each other. Everything is good until the "invite peer" part. I got the errors bellow:
2022-07-18 17:45:10.066594+0800 iRemoteMac[42755:5561655] [connection] nw_socket_handle_socket_event [C6:1] Socket SO_ERROR [54: Connection reset by peer]
2022-07-18 17:45:10.067320+0800 iRemoteMac[42755:5558565] [MCNearbyServiceAdvertiser] PeerConnection connectedHandler (advertiser side) - error [Unable to connect].
2022-07-18 17:45:10.067366+0800 iRemoteMac[42755:5558565] [MCNearbyServiceAdvertiser] PeerConnection connectedHandler remoteServiceName is nil.
2022-07-18 17:45:20.050295+0800 iRemoteMac[42755:5562197] [MCNearbyServiceAdvertiser] Data from peer [My Dev,721645DB] received with error Connection closed.
Any ideas on what causes this error? I don't see where the remoteServiceName is.
thanks
Well, I didn't set MCNearbyServiceAdvertiserDelegate right, that's why I can't invite peer, but sometimes I still get this error though the connection can be set.

Connection Errors on Initializing Spotify on iOS?

I have been struggling with implementing the Spotify iOS SDK in a simple music player app I’m working on with the intention of learning more about the streaming platform’s API. My app’s features are storyboard-based and have simple functionality (i.e. connect/disconnect, pause/play, fast forward/rewind, fetch album artwork)
I modeled my authorization method off of the demo project SPTLoginSampleAppSwift, and have been trying to troubleshoot the errors I’m getting (I’ll paste them below).
After a few weeks of struggling with this API, I decided to run the demo project on my device and realized that it does not seem to function properly either. Does anyone know how I can fix these errors and successfully initiate Spotify functionality in my app? I’m quite frustrated and would really appreciate any advice. I'm including my repo below as well.
https://github.com/dglaser2/SpotifyPlayer
ERRORS:
Upon clicking connect:
-canOpenURL: failed for URL: "spotify:" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
Upon returning to app after authorization screen:
2021-01-07 16:59:16.775788-0500 SpotifyPlayerDavid[39554:3692500] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
2021-01-07 16:59:16.907970-0500 SpotifyPlayerDavid[39554:3688560] AppRemote: Connecting...
2021-01-07 16:59:16.921229-0500 SpotifyPlayerDavid[39554:3692500] [connection] nw_socket_handle_socket_event [C2.1:1] Socket SO_ERROR [61: Connection refused]
2021-01-07 16:59:16.923633-0500 SpotifyPlayerDavid[39554:3692500] [connection] nw_socket_handle_socket_event [C2.2:1] Socket SO_ERROR [61: Connection refused]
2021-01-07 16:59:16.926122-0500 SpotifyPlayerDavid[39554:3691493] [connection] nw_connection_get_connected_socket [C2] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-01-07 16:59:16.926941-0500 SpotifyPlayerDavid[39554:3691493] TCP Conn 0x600002b6c0b0 Failed : error 0:61 [61]
2021-01-07 16:59:16.928526-0500 SpotifyPlayerDavid[39554:3688560] AppRemote: Failed connection attempt with error: Error Domain=com.spotify.app-remote.transport Code=-2000 "Stream error." UserInfo={NSLocalizedDescription=Stream error., NSUnderlyingError=0x600001228f00 {Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={_kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}}, NSLocalizedRecoverySuggestion=Reconnect the transport to the Spotify app., NSLocalizedFailureReason=A stream error has occured in the transport.

Fail to connetc AWS greengrass

My OS is Yocto Rocko on i.MX6Q.
I used docker v17.06 to load three greengrass image version 1.7.1, 1.8.1 and 1.9.2.
I followed the README.md in each package to setup up and install step by step.
All images were failed to connect AWS greengrass group I created.
The following are logs about the error, I think the reason is MQTT setting has something wrong. I google mosquitto.conf about greengrass, and I couldn't find any solution.
Here is my mosquitto info.
root#imx6qsabresd:/etc/mosquitto# mosquitto -h
mosquitto version 1.4.14 (build date 2019-06-26 15:24:46+0800)
mosquitto is an MQTT v3.1.1/v3.1 broker.
Could anyone tell me how to setting mosquitto.conf for greengrass?
Or is the root cause another one?
greengrass v1.7.1 log
[2019-07-01T02:49:18.214Z][INFO]-===========================================
[2019-07-01T02:49:18.214Z][INFO]-Greengrass Root: /greengrass
[2019-07-01T02:49:18.214Z][INFO]-Greengrass Write Directory: /greengrass/ggc
[2019-07-01T02:49:18.214Z][INFO]-Group File Directory: /greengrass/ggc/deployment/group
[2019-07-01T02:49:18.214Z][INFO]-Default Lambda UID: 122 GID: 121
[2019-07-01T02:49:18.214Z][INFO]-===========================================
[2019-07-01T02:49:18.223Z][INFO]-The current core is using the AWS IoT certificates with fingerprint: 5da1e3eb3aefdc0c3adf0607284ea00debba05af257ba42b96c9c211f441f5bf
[2019-07-01T02:49:18.224Z][WARN]-worker process info: /greengrass/ggc/packages/1.7.1/var/worker/processes
[2019-07-01T02:49:18.225Z][WARN]-worker process info: /greengrass/ggc/packages/1.7.1/var/worker/processes
[2019-07-01T02:49:18.234Z][INFO]-Reloading registry
[2019-07-01T02:49:18.236Z][INFO]-The current core is using the AWS IoT certificates with fingerprint: 5da1e3eb3aefdc0c3adf0607284ea00debba05af257ba42b96c9c211f441f5bf
[2019-07-01T02:49:23.291Z][WARN]-Attempt to establish MQTT connection with a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883 failed and will be retried: Network Error : dial tcp 52.192.233.211:8883: i/o timeout
[2019-07-01T02:49:28.297Z][WARN]-Attempt to establish MQTT connection with a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883 failed and will be retried: Network Error : dial tcp 52.199.190.37:8883: i/o timeout
[2019-07-01T02:49:34.303Z][WARN]-Attempt to establish MQTT connection with a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883 failed and will be retried: Network Error : dial tcp 52.192.233.211:8883: i/o timeout
[2019-07-01T02:49:39.309Z][WARN]-Attempt to establish MQTT connection with a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883 failed and will be retried: Network Error : dial tcp 52.199.190.37:8883: i/o timeout
[2019-07-01T02:49:45.315Z][WARN]-Attempt to establish MQTT connection with a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883 failed and will be retried: Network Error : dial tcp 52.192.233.211:8883: i/o timeout
[2019-07-01T02:49:53.321Z][WARN]-Attempt to establish MQTT connection with a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883 failed and will be retried: Network Error : dial tcp 52.199.190.37:8883: i/o timeout
[2019-07-01T02:50:20.327Z][WARN]-Attempt to establish MQTT connection with a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883 failed and will be retried: Network Error : dial tcp 52.192.233.211:8883: i/o timeout
[2019-07-01T02:50:45.363Z][WARN]-Attempt to establish MQTT connection with a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883 failed and will be retried: Network Error : dial tcp 52.196.224.122:8883: i/o timeout
greengrass v1.8.1 log
[2019-07-01T03:28:02.096Z][INFO]-MQTT connection attempt: attemptId: ibGG, clientId: zohan_Core
[2019-07-01T03:28:17.102Z][WARN]-MQTT[client] dial tcp 52.192.233.211:8883: i/o timeout
[2019-07-01T03:28:17.102Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:28:33.097Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:28:33.097Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: ibGG, clientId: zohan_Core: operation timed out
[2019-07-01T03:29:07.098Z][INFO]-MQTT connection attempt: attemptId: qPeP, clientId: zohan_Core
[2019-07-01T03:29:22.159Z][WARN]-MQTT[client] dial tcp 13.231.29.48:8883: i/o timeout
[2019-07-01T03:29:22.159Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:29:38.099Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:29:38.099Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: qPeP, clientId: zohan_Core: operation timed out
[2019-07-01T03:30:00.1Z][INFO]-MQTT connection attempt: attemptId: tQVE, clientId: zohan_Core
[2019-07-01T03:30:15.105Z][WARN]-MQTT[client] dial tcp 52.196.81.83:8883: i/o timeout
[2019-07-01T03:30:15.105Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:30:31.101Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:30:31.101Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: tQVE, clientId: zohan_Core: operation timed out
[2019-07-01T03:30:34.102Z][INFO]-MQTT connection attempt: attemptId: bbZJ, clientId: zohan_Core
[2019-07-01T03:30:49.134Z][WARN]-MQTT[client] dial tcp 52.199.190.37:8883: i/o timeout
[2019-07-01T03:30:49.134Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:31:05.103Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:31:05.103Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: bbZJ, clientId: zohan_Core: operation timed out
[2019-07-01T03:31:49.103Z][INFO]-MQTT connection attempt: attemptId: QZad, clientId: zohan_Core
[2019-07-01T03:32:04.144Z][WARN]-MQTT[client] dial tcp 52.192.233.211:8883: i/o timeout
[2019-07-01T03:32:04.144Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:32:20.105Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:32:20.105Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: QZad, clientId: zohan_Core: operation timed out
[2019-07-01T03:32:54.105Z][INFO]-MQTT connection attempt: attemptId: RhWa, clientId: zohan_Core
[2019-07-01T03:33:09.14Z][WARN]-MQTT[client] dial tcp 52.196.81.83:8883: i/o timeout
[2019-07-01T03:33:09.14Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:33:25.107Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:33:25.107Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: RhWa, clientId: zohan_Core: operation timed out
[2019-07-01T03:33:52.107Z][INFO]-MQTT connection attempt: attemptId: RKLh, clientId: zohan_Core
[2019-07-01T03:34:07.113Z][WARN]-MQTT[client] dial tcp 13.231.29.48:8883: i/o timeout
[2019-07-01T03:34:07.113Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:34:23.108Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:34:23.108Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: RKLh, clientId: zohan_Core: operation timed out
[2019-07-01T03:35:22.109Z][INFO]-MQTT connection attempt: attemptId: cJQX, clientId: zohan_Core
[2019-07-01T03:35:37.186Z][WARN]-MQTT[client] dial tcp 52.196.224.122:8883: i/o timeout
[2019-07-01T03:35:37.186Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:35:53.11Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:35:53.11Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: cJQX, clientId: zohan_Core: operation timed out
[2019-07-01T03:36:25.111Z][INFO]-MQTT connection attempt: attemptId: tPkl, clientId: zohan_Core
[2019-07-01T03:36:40.176Z][WARN]-MQTT[client] dial tcp 52.196.224.122:8883: i/o timeout
[2019-07-01T03:36:40.176Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:36:56.112Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-07-01T03:36:56.112Z][WARN]-MQTT connection attempt failed and will be retried: attemptId: tPkl, clientId: zohan_Core: operation timed out
[2019-07-01T03:37:22.112Z][INFO]-MQTT connection attempt: attemptId: RJbR, clientId: zohan_Core
[2019-07-01T03:37:37.118Z][WARN]-MQTT[client] dial tcp 54.178.150.112:8883: i/o timeout
[2019-07-01T03:37:37.118Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-07-01T03:37:53.113Z][WARN]-MQTT[store] Trying to close memory store, but not open
greengrass v1.9.2 log
ogot#imx6qsabresd:/usr/aws/aws-greengrass-docker-1.9.2/log/system# cat runtime.lo
[2019-06-28T03:12:10.073Z][DEBUG]-Disconnecting client
[2019-06-28T03:12:10.073Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:12:10.073Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:12:10.073Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "RHeO", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:12:11.074Z][DEBUG]-MQTT connection attempt. {"attemptId": "LcQc", "clientId": "zohan_Core"}
[2019-06-28T03:12:11.074Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:12:11.074Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:12:11.074Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:12:26.128Z][WARN]-MQTT[client] dial tcp 52.196.224.122:8883: i/o timeout
[2019-06-28T03:12:26.128Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:06:24.813Z][INFO]-===========================================
[2019-06-28T03:06:24.813Z][INFO]-Greengrass Version: 1.9.2-RC4
[2019-06-28T03:06:24.813Z][INFO]-Greengrass Root: /greengrass
[2019-06-28T03:06:24.813Z][INFO]-Greengrass Write Directory: /greengrass/ggc
[2019-06-28T03:06:24.813Z][INFO]-Group File Directory: /greengrass/ggc/deployment/group
[2019-06-28T03:06:24.813Z][INFO]-Default Lambda UID: 122
[2019-06-28T03:06:24.813Z][INFO]-Default Lambda GID: 121
[2019-06-28T03:06:24.813Z][DEBUG]-Go version: go1.10.3
[2019-06-28T03:06:24.814Z][DEBUG]-CoreThing Connection Config:
{
"Region": "ap-northeast-1",
"ThingArn": "arn:aws:iot:ap-northeast-1:268205529033:thing/zohan_Core",
"IoTMQTTEndpoint": "a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883",
"IoTHTTPEndpoint": "a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8443",
"GGMQTTEndpoint": "greengrass-ats.iot.ap-northeast-1.amazonaws.com:8883",
"GGHTTPEndpoint": "greengrass-ats.iot.ap-northeast-1.amazonaws.com:8443",
"GGMQTTKeepAlive": 600,
"GGMQTTMaxConnectionRetryInterval": 60,
"GGMQTTConnectTimeout": 30,
"GGMQTTPingTimeout": 30,
"GGHTTPTimeout": 60,
"FIPSMode": false,
"CoreClientId": ""
}
[2019-06-28T03:06:24.814Z][DEBUG]-System Config:
{
"tmpDirectory": "",
"shadowSyncTimeout": 0
}
[2019-06-28T03:06:24.814Z][DEBUG]-Runtime Config:
{
"maxWorkItemCount": 1024,
"schedulingFrequency": 1000,
"maxConcurrentLimit": 25,
"lruSize": 25,
"cgroup": {
"useSystemd": true,
"mountPoint": null
},
"postStartHealthCheckTimeout": 60000,
"allowFunctionsToRunAsRoot": false,
"onSystemComponentsFailure": 0
}
[2019-06-28T03:06:24.814Z][INFO]-===========================================
[2019-06-28T03:06:24.814Z][DEBUG]-[3]Requested certificate load [file:///greengrass/certs/5da1e3eb3a.cert.pem] with error: [<nil>]
[2019-06-28T03:06:24.814Z][INFO]-The current core is using the AWS IoT certificates with fingerprint. {"fingerprint": "5da1e3eb3aefdc0c3adf0607284ea00debba05af257ba42b96c9c211f441f5bf"}
[2019-06-28T03:06:24.815Z][INFO]-Will persist worker process info. {"dir": "/greengrass/ggc/packages/1.9.2/var/worker/processes"}
[2019-06-28T03:06:24.816Z][INFO]-Will persist worker process info. {"dir": "/greengrass/ggc/packages/1.9.2/var/worker/processes"}
[2019-06-28T03:06:24.817Z][DEBUG]-loading subscriptions {"trie": "map[]"}
[2019-06-28T03:06:24.819Z][DEBUG]-[3]Requested certificate load [file:///greengrass/certs/root.ca.pem] with error: [<nil>]
[2019-06-28T03:06:24.823Z][DEBUG]-[3]Requested key load [file:///greengrass/certs/5da1e3eb3a.private.key] with error: [<nil>]
[2019-06-28T03:06:24.823Z][DEBUG]-[3]Requested certificate load [file:///greengrass/certs/5da1e3eb3a.cert.pem] with error: [<nil>]
[2019-06-28T03:06:24.826Z][INFO]-No proxy URL found.
[2019-06-28T03:06:24.827Z][DEBUG]-Reloading function registry.
[2019-06-28T03:06:24.828Z][DEBUG]-[3]Requested certificate load [file:///greengrass/certs/5da1e3eb3a.cert.pem] with error: [<nil>]
[2019-06-28T03:06:24.828Z][INFO]-The current core is using the AWS IoT certificates with fingerprint. {"fingerprint": "5da1e3eb3aefdc0c3adf0607284ea00debba05af257ba42b96c9c211f441f5bf"}
[2019-06-28T03:06:24.833Z][DEBUG]-[3]Requested certificate load [file:///greengrass/certs/root.ca.pem] with error: [<nil>]
[2019-06-28T03:06:24.836Z][DEBUG]-[3]Requested key load [file:///greengrass/certs/5da1e3eb3a.private.key] with error: [<nil>]
[2019-06-28T03:06:24.837Z][DEBUG]-[3]Requested certificate load [file:///greengrass/certs/5da1e3eb3a.cert.pem] with error: [<nil>]
[2019-06-28T03:06:24.84Z][INFO]-Started Deployment Agent to listen for updates.
[2019-06-28T03:06:24.841Z][INFO]-Connecting with MQTT. {"endpoint": "a3ha96wpso16t3-ats.iot.ap-northeast-1.amazonaws.com:8883", "clientId": "zohan_Core"}
[2019-06-28T03:06:24.841Z][DEBUG]-MQTT connection attempt. {"attemptId": "sbXW", "clientId": "zohan_Core"}
[2019-06-28T03:06:24.841Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:06:24.841Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:06:24.841Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:46:09.317Z][WARN]-MQTT[client] dial tcp 52.196.81.83:8883: i/o timeout
[2019-06-28T03:46:09.317Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:46:25.26Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:46:25.26Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:46:25.26Z][DEBUG]-Disconnecting client
[2019-06-28T03:46:25.261Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:46:25.261Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:46:25.261Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "sbXW", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:46:25.261Z][DEBUG]-MQTT connection attempt. {"attemptId": "nTLn", "clientId": "zohan_Core"}
[2019-06-28T03:46:25.261Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:46:25.261Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:46:25.261Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:46:40.266Z][WARN]-MQTT[client] dial tcp 13.231.29.48:8883: i/o timeout
[2019-06-28T03:46:40.266Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:46:56.262Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:46:56.262Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:46:56.262Z][DEBUG]-Disconnecting client
[2019-06-28T03:46:56.262Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:46:56.262Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:46:56.263Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "nTLn", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:46:57.263Z][DEBUG]-MQTT connection attempt. {"attemptId": "qkJH", "clientId": "zohan_Core"}
[2019-06-28T03:46:57.263Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:46:57.264Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:46:57.264Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:47:12.307Z][WARN]-MQTT[client] dial tcp 54.178.150.112:8883: i/o timeout
[2019-06-28T03:47:12.308Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:47:28.264Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:47:28.264Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:47:28.264Z][DEBUG]-Disconnecting client
[2019-06-28T03:47:28.265Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:47:28.265Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:47:28.265Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "qkJH", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:47:28.265Z][DEBUG]-MQTT connection attempt. {"attemptId": "DTsS", "clientId": "zohan_Core"}
[2019-06-28T03:47:28.265Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:47:28.265Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:47:28.265Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:47:43.27Z][WARN]-MQTT[client] dial tcp 52.196.224.122:8883: i/o timeout
[2019-06-28T03:47:43.27Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:47:59.266Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:47:59.266Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:47:59.266Z][DEBUG]-Disconnecting client
[2019-06-28T03:47:59.266Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:47:59.266Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:47:59.266Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "DTsS", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:48:02.267Z][DEBUG]-MQTT connection attempt. {"attemptId": "EkzV", "clientId": "zohan_Core"}
[2019-06-28T03:48:02.267Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:48:02.267Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:48:02.267Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:48:17.325Z][WARN]-MQTT[client] dial tcp 52.199.190.37:8883: i/o timeout
[2019-06-28T03:48:17.325Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:48:33.268Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:48:33.268Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:48:33.268Z][DEBUG]-Disconnecting client
[2019-06-28T03:48:33.268Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:48:33.268Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:48:33.268Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "EkzV", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:48:45.269Z][DEBUG]-MQTT connection attempt. {"attemptId": "bRjP", "clientId": "zohan_Core"}
[2019-06-28T03:48:45.269Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:48:45.269Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:48:45.269Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:49:00.275Z][WARN]-MQTT[client] dial tcp 52.192.233.211:8883: i/o timeout
[2019-06-28T03:49:00.275Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:49:16.27Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:49:16.27Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:49:16.27Z][DEBUG]-Disconnecting client
[2019-06-28T03:49:16.27Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:49:16.27Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:49:16.27Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "bRjP", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:49:16.271Z][DEBUG]-MQTT connection attempt. {"attemptId": "HyAU", "clientId": "zohan_Core"}
[2019-06-28T03:49:16.271Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:49:16.271Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:49:16.271Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:49:31.333Z][WARN]-MQTT[client] dial tcp 52.192.233.211:8883: i/o timeout
[2019-06-28T03:49:31.333Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:49:47.271Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:49:47.271Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:49:47.271Z][DEBUG]-Disconnecting client
[2019-06-28T03:49:47.272Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:49:47.272Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:49:47.272Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "HyAU", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:50:14.272Z][DEBUG]-MQTT connection attempt. {"attemptId": "suqf", "clientId": "zohan_Core"}
[2019-06-28T03:50:14.273Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:50:14.273Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:50:14.273Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:50:29.278Z][WARN]-MQTT[client] dial tcp 52.199.190.37:8883: i/o timeout
[2019-06-28T03:50:29.278Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:50:45.274Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:50:45.274Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:50:45.274Z][DEBUG]-Disconnecting client
[2019-06-28T03:50:45.274Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:50:45.274Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:50:45.274Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "suqf", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:51:29.275Z][DEBUG]-MQTT connection attempt. {"attemptId": "YfqT", "clientId": "zohan_Core"}
[2019-06-28T03:51:29.275Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:51:29.275Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:51:29.275Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:51:44.314Z][WARN]-MQTT[client] dial tcp 52.199.190.37:8883: i/o timeout
[2019-06-28T03:51:44.315Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:52:00.276Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:52:00.276Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:52:00.276Z][DEBUG]-Disconnecting client
[2019-06-28T03:52:00.276Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:52:00.276Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:52:00.276Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "YfqT", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:52:56.277Z][DEBUG]-MQTT connection attempt. {"attemptId": "DIBy", "clientId": "zohan_Core"}
[2019-06-28T03:52:56.277Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:52:56.277Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:52:56.277Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:53:11.338Z][WARN]-MQTT[client] dial tcp 52.196.81.83:8883: i/o timeout
[2019-06-28T03:53:11.338Z][WARN]-MQTT[client] Failed to connect to a broker
[2019-06-28T03:53:27.278Z][DEBUG]-Marking connection request as invalid
[2019-06-28T03:53:27.278Z][DEBUG]-Disconnect client {"force": true}
[2019-06-28T03:53:27.278Z][DEBUG]-Disconnecting client
[2019-06-28T03:53:27.278Z][WARN]-MQTT[store] Trying to close memory store, but not open
[2019-06-28T03:53:27.278Z][DEBUG]-Releasing lock for connection attempt
[2019-06-28T03:53:27.278Z][WARN]-MQTT connection attempt failed and will be retried. {"attemptId": "DIBy", "clientId": "zohan_Core", "errorString": "operation timed out"}
[2019-06-28T03:53:38.279Z][DEBUG]-MQTT connection attempt. {"attemptId": "RAeH", "clientId": "zohan_Core"}
[2019-06-28T03:53:38.279Z][DEBUG]-New MQTT connection attempt
[2019-06-28T03:53:38.279Z][DEBUG]-Acquired lock for connection attempt
[2019-06-28T03:53:38.279Z][DEBUG]-Disconnect client {"force": false}
[2019-06-28T03:53:53.285Z][WARN]-MQTT[client] dial tcp 13.231.29.48:8883: i/o timeout
[2019-06-28T03:53:53.285Z][WARN]-MQTT[client] Failed to connect to a broker
You can use AWS MQTT on port 443 which is usually available. To use this port http header value "application protocol name" needs to be set to “x-amzn-mqtt-ca”. Please read more on this here:
https://aws.amazon.com/blogs/iot/mqtt-with-tls-client-authentication-on-port-443-why-it-is-useful-and-how-it-works/
Greengrass has its own MQTT broker.
If you want to connect MQTT clients to AWS Greengrass, you have to follow their
directions at
https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-gs.html
We have FAILED to connect mosquitto client to Greengrass as documented at
https://forums.aws.amazon.com/thread.jspa?threadID=305032&tstart=0
(which you will likely only see if you login to AWS).

Resources