{"action":"created","issue":{"url":"https://api.github.com/repos/knolleary/pubsubclient/issues/185","repository_url":"https://api.github.com/repos/knolleary/pubsubclient","labels_url":"https://api.github.com/repos/knolleary/pubsubclient/issues/185/labels{/name}","comments_url":"https://api.github.com/repos/knolleary/pubsubclient/issues/185/comments","events_url":"https://api.github.com/repos/knolleary/pubsubclient/issues/185/events","html_url":"https://github.com/knolleary/pubsubclient/issues/185","id":168300223,"node_id":"MDU6SXNzdWUxNjgzMDAyMjM=","number":185,"title":"Attempting MQTT connection...failed, rc=-2 try again in 5 seconds","user":{"login":"mohitsachan33","id":20722958,"node_id":"MDQ6VXNlcjIwNzIyOTU4","avatar_url":"https://avatars0.githubusercontent.com/u/20722958?v=4","gravatar_id":"","url":"https://api.github.com/users/mohitsachan33","html_url":"https://github.com/mohitsachan33","followers_url":"https://api.github.com/users/mohitsachan33/followers","following_url":"https://api.github.com/users/mohitsachan33/following{/other_user}","gists_url":"https://api.github.com/users/mohitsachan33/gists{/gist_id}","starred_url":"https://api.github.com/users/mohitsachan33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohitsachan33/subscriptions","organizations_url":"https://api.github.com/users/mohitsachan33/orgs","repos_url":"https://api.github.com/users/mohitsachan33/repos","events_url":"https://api.github.com/users/mohitsachan33/events{/privacy}","received_events_url":"https://api.github.com/users/mohitsachan33/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-07-29T10:53:37Z","updated_at":"2018-08-27T09:01:25Z","closed_at":null,"author_association":"NONE","body":"// Control ESP8266 anywhere\n// Import required libraries\n# include <ESP8266WiFi.h>\n# include <PubSubClient.h>\n# include <aREST.h>\n\n// Clients\nWiFiClient espClient;\nPubSubClient client(espClient);\n// Create aREST instance\naREST rest = aREST(client);\n// Unique ID to identify the device for cloud.arest.io\nchar\\* device_id = \"e49n2di\";\n// WiFi parameters\nconst char\\* ssid = \"Quasar\";\nconst char\\* password = \"quablu49476\";\n// Functions\nvoid callback(char\\* topic, byte\\* payload, unsigned int length);\nvoid setup(void)\n{\n  // Start Serial\n  Serial.begin(115200);\n  // Set callback\n  client.setCallback(callback);\n\n  // Give name and ID to device\n  rest.set_id(device_id);\n  rest.set_name(\"relay_anywhere\");\n  // Connect to WiFi\n  WiFi.begin(ssid, password);\n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(\".\");\n  }\n  Serial.println(\"\");\n  Serial.println(\"WiFi connected\");\n  // Set output topic\n  char\\* out_topic = rest.get_topic();\n}\nvoid loop() {\n  // Connect to the cloud\n  rest.loop(client);\n}\n// Handles message arrived on subscribed topic(s)\nvoid callback(char\\* topic, byte\\* payload, unsigned int length) {\n  rest.handle_callback(client, topic, payload, length);\n}\n\nthis is my code and when i opened serial monitor in arduino ide then continuously its shows like--\n\n..\nWiFi connected\nAttempting MQTT connection...failed, rc=-2 try again in 5 seconds\nAttempting MQTT connection...Connected to aREST.io\nAttempting MQTT connection...failed, rc=-2 try again in 5 seconds\nAttempting MQTT connection...Connected to aREST.io\nAttempting MQTT connection...failed, rc=-2 try again in 5 seconds\nAttempting MQTT connection...failed, rc=-2 try again in 5 seconds\nAttempting MQTT connection...failed, rc=-2 try again in 5 seconds\nAttempting MQTT connection...Connected to aREST.io\nAttempting MQTT connection...failed, rc=-2 try again in 5 seconds\n"},"comment":{"url":"https://api.github.com/repos/knolleary/pubsubclient/issues/comments/416162820","html_url":"https://github.com/knolleary/pubsubclient/issues/185#issuecomment-416162820","issue_url":"https://api.github.com/repos/knolleary/pubsubclient/issues/185","id":416162820,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNjE2MjgyMA==","user":{"login":"alwashe","id":15383159,"node_id":"MDQ6VXNlcjE1MzgzMTU5","avatar_url":"https://avatars3.githubusercontent.com/u/15383159?v=4","gravatar_id":"","url":"https://api.github.com/users/alwashe","html_url":"https://github.com/alwashe","followers_url":"https://api.github.com/users/alwashe/followers","following_url":"https://api.github.com/users/alwashe/following{/other_user}","gists_url":"https://api.github.com/users/alwashe/gists{/gist_id}","starred_url":"https://api.github.com/users/alwashe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alwashe/subscriptions","organizations_url":"https://api.github.com/users/alwashe/orgs","repos_url":"https://api.github.com/users/alwashe/repos","events_url":"https://api.github.com/users/alwashe/events{/privacy}","received_events_url":"https://api.github.com/users/alwashe/received_events","type":"User","site_admin":false},"created_at":"2018-08-27T09:01:25Z","updated_at":"2018-08-27T09:01:25Z","author_association":"NONE","body":"it was the host, it works with ip adress:\r\nsolved: **https://github.com/knolleary/pubsubclient/issues/486#issuecomment-415846183**"}}
{"actor":{"display_login":"alwashe"}}