{"action":"created","issue":{"url":"https://api.github.com/repos/mqttjs/MQTT.js/issues/509","repository_url":"https://api.github.com/repos/mqttjs/MQTT.js","labels_url":"https://api.github.com/repos/mqttjs/MQTT.js/issues/509/labels{/name}","comments_url":"https://api.github.com/repos/mqttjs/MQTT.js/issues/509/comments","events_url":"https://api.github.com/repos/mqttjs/MQTT.js/issues/509/events","html_url":"https://github.com/mqttjs/MQTT.js/issues/509","id":193334848,"number":509,"title":"Connect on event","user":{"login":"chimit","id":839349,"avatar_url":"https://avatars.githubusercontent.com/u/839349?v=3","gravatar_id":"","url":"https://api.github.com/users/chimit","html_url":"https://github.com/chimit","followers_url":"https://api.github.com/users/chimit/followers","following_url":"https://api.github.com/users/chimit/following{/other_user}","gists_url":"https://api.github.com/users/chimit/gists{/gist_id}","starred_url":"https://api.github.com/users/chimit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chimit/subscriptions","organizations_url":"https://api.github.com/users/chimit/orgs","repos_url":"https://api.github.com/users/chimit/repos","events_url":"https://api.github.com/users/chimit/events{/privacy}","received_events_url":"https://api.github.com/users/chimit/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-04T06:24:14Z","updated_at":"2016-12-05T03:16:12Z","closed_at":"2016-12-04T09:04:25Z","body":"Sorry for the stupid question, but how can I initiate a connection on another event? For example, on button push? I'm using MQTT.js in the browser."},"comment":{"url":"https://api.github.com/repos/mqttjs/MQTT.js/issues/comments/264759219","html_url":"https://github.com/mqttjs/MQTT.js/issues/509#issuecomment-264759219","issue_url":"https://api.github.com/repos/mqttjs/MQTT.js/issues/509","id":264759219,"user":{"login":"chimit","id":839349,"avatar_url":"https://avatars.githubusercontent.com/u/839349?v=3","gravatar_id":"","url":"https://api.github.com/users/chimit","html_url":"https://github.com/chimit","followers_url":"https://api.github.com/users/chimit/followers","following_url":"https://api.github.com/users/chimit/following{/other_user}","gists_url":"https://api.github.com/users/chimit/gists{/gist_id}","starred_url":"https://api.github.com/users/chimit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chimit/subscriptions","organizations_url":"https://api.github.com/users/chimit/orgs","repos_url":"https://api.github.com/users/chimit/repos","events_url":"https://api.github.com/users/chimit/events{/privacy}","received_events_url":"https://api.github.com/users/chimit/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T03:16:12Z","updated_at":"2016-12-05T03:16:12Z","body":"Sorry, @mcollina, maybe I'm not clear enough. I want to bind the connection to some event like this:\r\n```\r\nconst client = mqtt.createClient({\r\n    host: 'abc',\r\n    port: 8883,\r\n    protocol: 'mqtts',\r\n    username: 'abc',\r\n    password: 'abc',\r\n});\r\n\r\n$('#connect').click(function() {\r\n    client.connect();\r\n```\r\nIs it still impossible?"}}
{"actor":{"display_login":"chimit"}}