I'm trying to implement FCM to send a push notification (using the legacy api), but am unable to do so.
I have verified that my server key (taken from Firebase console) and device token are accurate, and I have successfully sent a push note to my device via Postman.
However, I am unable to do so via code. I am calling the below code from my simulator and "attempting" to send a push note to my physical device.
let urlString: String = "https://fcm/googleapis.com/fcm/send"
let key = "key=[my server key]"
let headers: HTTPHeaders = [
"Content-Type": "application/json",
"Authorization": key
]
let notificationParameters: Parameters = [
"to": "[my push token of physical device]",
"notification": [
"title": "My title",
"body": "My body"
]
]
print("1")
AF.request(urlString, method: .post, parameters:
notificationParameters, encoding: JSONEncoding.default, headers:
headers).responseJSON { response in
print("3")
switch response.result {
case .success:
printSuccess("Successfully sent notification")
case .failure(let error):
print("Failed to send notification: \(error)")
print(error.errorDescription)
print(error.failureReason)
}
print("4")
}
print("2")
Here's the log:
1
2
2022-03-31 15:23:24.725607-0500 Wurtle with Friends[22207:12775410]
[connection] nw_socket_handle_socket_event [C3.1:3] Socket SO_ERROR
[61: Connection refused]
2022-03-31 15:23:24.727572-0500 Wurtle with Friends[22207:12775410]
Connection 3: received failure notification
2022-03-31 15:23:24.727789-0500 Wurtle with Friends[22207:12775410]
Connection 3: failed to connect 1:61, reason -1
2022-03-31 15:23:24.728130-0500 Wurtle with Friends[22207:12775410]
Connection 3: encountered error(1:61)
2022-03-31 15:23:24.729779-0500 Wurtle with Friends[22207:12775409]
[boringssl] boringssl_metrics_log_metric_block_invoke(153) Failed
to log metrics
2022-03-31 15:23:24.731134-0500 Wurtle with Friends[22207:12775410]
Task <B52206D8-E22D-4D8F-B3F5-815692558860>.<1> HTTP load failed,
0/0 bytes (error code: -1004 [1:61])
2022-03-31 15:23:24.736922-0500 Wurtle with Friends[22207:12775410]
Task <B52206D8-E22D-4D8F-B3F5-815692558860>.<1> finished with error
[-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not connect
to the server." UserInfo={_kCFStreamErrorCodeKey=61,
NSUnderlyingError=0x60000279c300 {Error
Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo=
{_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface:
en1, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}},
_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <B52206D8-
E22D-4D8F-B3F5-815692558860>.<1>,
_NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <B52206D8-E22D-4D8F-B3F5-815692558860>.<1>"
), NSLocalizedDescription=Could not connect to the server.,
NSErrorFailingURLStringKey=https://fcm/googleapis.com/fcm/send,
NSErrorFailingURLKey=https://fcm/googleapis.com/fcm/send,
_kCFStreamErrorDomainKey=1}
3
Failed to send notification: sessionTaskFailed(error: Error
Domain=NSURLErrorDomain Code=-1004 "Could not connect to the
server." UserInfo={_kCFStreamErrorCodeKey=61,
NSUnderlyingError=0x60000279c300 {Error
Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo=
{_NSURLErrorNWPathKey=satisfied (Path is satisfied), interface:
en1, _kCFStreamErrorCodeKey=61, _kCFStreamErrorDomainKey=1}},
_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <B52206D8-
E22D-4D8F-B3F5-815692558860>.<1>,
_NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <B52206D8-E22D-4D8F-B3F5-815692558860>.<1>"
), NSLocalizedDescription=Could not connect to the server.,
NSErrorFailingURLStringKey=https://fcm/googleapis.com/fcm/send,
NSErrorFailingURLKey=https://fcm/googleapis.com/fcm/send,
_kCFStreamErrorDomainKey=1})
Optional("URLSessionTask failed with error: Could not connect to
the server.")
4
This is my first time implementing FCM and I've been stuck on it for a while now, so any help is appreciated. Thank you
Even though I do not recommend sending an FCM request straight from the app, it appears you have a typo in your server URL address.
Just change it to https://fcm.googleapis.com/fcm/send
you must get the FCM token and refresh token as the firebase console said in the Appdelegate file:
https://firebase.google.com/docs/cloud-messaging/ios/client
you shouldn't send push from the iOS app, this is not secure because of the server key and etc, and also you must add the cloud message certificate and message key as firebase requested.
and also you must have destination fcm token (per device).
Push Notification Sender must be your Backend that have all device FCM Tokens.
you must send FCM Token that you get in Appdelegate per ["user" , "device"] to backend and your backend must save it for user device.
FCM Token is a map key foreach device APNS token.
Steps to reproduce:
Create a new app and call any API to the server to get data
immediately take the app to background
network get disconnects
below is the log:
2020-03-26 17:21:00.894598+0530 TestApp[783:152843] Connection 2: received failure notification
2020-03-26 17:21:00.895805+0530 TestApp[783:152843] Connection 2: failed to connect 1:53, reason -1
2020-03-26 17:21:00.895895+0530 TestApp[783:152843] Connection 2: encountered error(1:53)
2020-03-26 17:21:00.901375+0530 TestApp[783:152843] Task <36B9553A-99F2-42FE-8650-A5E5155EFCFD>.<1> HTTP load failed, 0/0 bytes (error code: -1005 [1:53])
2020-03-26 17:21:00.901831+0530 TestApp[783:152843] Connection 1: received failure notification
2020-03-26 17:21:00.902078+0530 TestApp[783:152843] [] nw_flow_add_write_request [C1.1 40.85.185.46:443 failed channel-flow (satisfied (Path is satisfied), interface: en0, ipv4, dns)] cannot accept write requests
2020-03-26 17:21:00.902200+0530 TestApp[783:152843] [] nw_write_request_report [C1] Send failed with error "Socket is not connected"
2020-03-26 17:21:00.905902+0530 TestApp[783:152870] Task <36B9553A-99F2-42FE-8650-A5E5155EFCFD>.<1> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSUnderlyingError=0x2824734e0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={_kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, NSErrorFailingURLStringKey=https://api.server.account, NSErrorFailingURLKey=https://api.server.account, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=53, NSLocalizedDescription=The network connection was lost.}
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).
I am trying to use audio call in app, But when I call from a device to other device, It does not connect with device and automatically disconnected with twilio Api. What is that problem occurred in app?
2018-11-21 10:43:32.226794+0530 AppName[243:9466] StartCallAction transaction request successful
2018-11-21 10:43:32.279094+0530 AppName[243:7164] providerDidBegin
2018-11-21 10:43:32.279737+0530 AppName[243:7164] provider:performStartCallAction:
WARNING: no real random source present!
2018-11-21 10:43:32.308053+0530 AppName[243:7164] [INFO Twilio] recreateMainTransport, Found valid IPv4 address: IPAddress
2018-11-21 10:43:32.309170+0530 AppName[243:9465] [INFO TVOMakeCallCommand] Call URI: sip:None#chunderm.gll.twilio.com;transport=tls
2018-11-21 10:43:32.722550+0530 AppName[243:7164] provider:didActivateAudioSession:
2018-11-21 10:43:38.396482+0530 AppName[243:9514] TIC TCP Conn Failed [72:0x15ef5ca50]: 1:61 Err(61)
2018-11-21 10:43:38.397055+0530 AppName[243:9514] Task <7129FEF4-4EBE-4AC5-9B34-5E0D002AE56F>.<1> HTTP load failed (error code: -1004 [1:61])
2018-11-21 10:43:38.399459+0530 AppName[243:9466] Task <7129FEF4-4EBE-4AC5-9B34-5E0D002AE56F>.<1> finished with error - code: -1004
2018-11-21 10:43:38.808257+0530 AppName[243:7164] Call failed to connect: Connection error (503).
I Have implemented this url.
Development mode notification is working but in production its not working. and shows errors.
dakshas-iMac:alootamatar daksha$ php push_demo.php
Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18
Warning: stream_socket_client(): unable to connect to ssl://gateway.push-apple.com:2195 (php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known) in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18
Failed to connect: 0 php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known
iMac:alootamatar daksha$ php push_demo.php
Warning: stream_socket_client(): Unable to set private key file `/Users/daksha/Desktop/alootamatar/cert.pem' in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18
Warning: stream_socket_client(): failed to create an SSL handle in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18
Warning: stream_socket_client(): Failed to enable crypto in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18
Warning: stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Unknown error) in /Users/daksha/Desktop/alootamatar/push_demo.php on line 18
Failed to connect: 0
After using APNS tester got response
2016-01-01 09:37:08 +0000: Set SSL connection
2016-01-01 09:37:08 +0000: Set peer domain name gateway.push.apple.com
2016-01-01 09:37:08 +0000: Keychain Opened
2016-01-01 09:37:08 +0000: Certificate data for Apple Production IOS Push Services: com.daksha.alootamatar initialized successfully
2016-01-01 09:37:08 +0000: Sec Identity created
2016-01-01 09:37:08 +0000: Client certificate created
2016-01-01 09:37:10 +0000: Connected
2016-01-01 09:37:10 +0000: Token: <f65ed342 4416c0bf e2a8c26a f3eb9a69 70780771 4eadb033 61ca8aec c28d454a>
2016-01-01 09:37:10 +0000: Written 92 bytes sending data to gateway.push.apple.com:2195
2016-01-01 09:37:10 +0000: Disconnected from server gateway.push.apple.com:2195
First of all make sure you install production APN certificates on your server, not development certificates.
After that make sure, you are sending the notification to right server URL
Sandbox: gateway.sandbox.push.apple.com, port 2195. (for
thedevelopment)
Production: gateway.push.apple.com, port 2195. (for the release)
Still you have the same problem, try this App. APN Tester