{"action":"created","issue":{"url":"https://api.github.com/repos/TheThingsNetwork/node-app-lib/issues/9","repository_url":"https://api.github.com/repos/TheThingsNetwork/node-app-lib","labels_url":"https://api.github.com/repos/TheThingsNetwork/node-app-lib/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/TheThingsNetwork/node-app-lib/issues/9/comments","events_url":"https://api.github.com/repos/TheThingsNetwork/node-app-lib/issues/9/events","html_url":"https://github.com/TheThingsNetwork/node-app-lib/issues/9","id":177353652,"number":9,"title":"Add support to subscribe to a specific topic","user":{"login":"FokkeZB","id":2699409,"avatar_url":"https://avatars.githubusercontent.com/u/2699409?v=3","gravatar_id":"","url":"https://api.github.com/users/FokkeZB","html_url":"https://github.com/FokkeZB","followers_url":"https://api.github.com/users/FokkeZB/followers","following_url":"https://api.github.com/users/FokkeZB/following{/other_user}","gists_url":"https://api.github.com/users/FokkeZB/gists{/gist_id}","starred_url":"https://api.github.com/users/FokkeZB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FokkeZB/subscriptions","organizations_url":"https://api.github.com/users/FokkeZB/orgs","repos_url":"https://api.github.com/users/FokkeZB/repos","events_url":"https://api.github.com/users/FokkeZB/events{/privacy}","received_events_url":"https://api.github.com/users/FokkeZB/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"FokkeZB","id":2699409,"avatar_url":"https://avatars.githubusercontent.com/u/2699409?v=3","gravatar_id":"","url":"https://api.github.com/users/FokkeZB","html_url":"https://github.com/FokkeZB","followers_url":"https://api.github.com/users/FokkeZB/followers","following_url":"https://api.github.com/users/FokkeZB/following{/other_user}","gists_url":"https://api.github.com/users/FokkeZB/gists{/gist_id}","starred_url":"https://api.github.com/users/FokkeZB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FokkeZB/subscriptions","organizations_url":"https://api.github.com/users/FokkeZB/orgs","repos_url":"https://api.github.com/users/FokkeZB/repos","events_url":"https://api.github.com/users/FokkeZB/events{/privacy}","received_events_url":"https://api.github.com/users/FokkeZB/received_events","type":"User","site_admin":false},"assignees":[{"login":"FokkeZB","id":2699409,"avatar_url":"https://avatars.githubusercontent.com/u/2699409?v=3","gravatar_id":"","url":"https://api.github.com/users/FokkeZB","html_url":"https://github.com/FokkeZB","followers_url":"https://api.github.com/users/FokkeZB/followers","following_url":"https://api.github.com/users/FokkeZB/following{/other_user}","gists_url":"https://api.github.com/users/FokkeZB/gists{/gist_id}","starred_url":"https://api.github.com/users/FokkeZB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FokkeZB/subscriptions","organizations_url":"https://api.github.com/users/FokkeZB/orgs","repos_url":"https://api.github.com/users/FokkeZB/repos","events_url":"https://api.github.com/users/FokkeZB/events{/privacy}","received_events_url":"https://api.github.com/users/FokkeZB/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-09-16T06:26:42Z","updated_at":"2016-09-19T10:51:37Z","closed_at":null,"body":"For example: `/+/devices/+/up/temperature`.\r\n\r\nThe challenge is that if the topic comes in the `+` are the actual app/device IDs so unless we duplicate MQTT's wildcard matching it's hard to map it to an event with the same name. Probably best to have a single event much like MQTT's [message](https://www.npmjs.com/package/mqtt#event-message) which includes the topic."},"comment":{"url":"https://api.github.com/repos/TheThingsNetwork/node-app-lib/issues/comments/247962799","html_url":"https://github.com/TheThingsNetwork/node-app-lib/issues/9#issuecomment-247962799","issue_url":"https://api.github.com/repos/TheThingsNetwork/node-app-lib/issues/9","id":247962799,"user":{"login":"johanstokking","id":13334001,"avatar_url":"https://avatars.githubusercontent.com/u/13334001?v=3","gravatar_id":"","url":"https://api.github.com/users/johanstokking","html_url":"https://github.com/johanstokking","followers_url":"https://api.github.com/users/johanstokking/followers","following_url":"https://api.github.com/users/johanstokking/following{/other_user}","gists_url":"https://api.github.com/users/johanstokking/gists{/gist_id}","starred_url":"https://api.github.com/users/johanstokking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanstokking/subscriptions","organizations_url":"https://api.github.com/users/johanstokking/orgs","repos_url":"https://api.github.com/users/johanstokking/repos","events_url":"https://api.github.com/users/johanstokking/events{/privacy}","received_events_url":"https://api.github.com/users/johanstokking/received_events","type":"User","site_admin":false},"created_at":"2016-09-19T10:51:37Z","updated_at":"2016-09-19T10:51:37Z","body":"Yep, I'd say one method:\r\n\r\n```\r\nclient.on('message', [devices], [field], function(deviceId, fields, payload) {\r\n});\r\n```\r\n\r\nIf `[devices]` is set, and either a string or an array, subscribe to that device or devices. Otherwise, subscribe to `+`. If `[field]` is set, subscribe to that field, otherwise subscribe to `up`.\r\n\r\nNote that, when subscribing to a field, the `fields` parameter in the callback becomes a bit useless. When subscribing to the field `temperature`, we might want to have `{ temperature: payload }` in there, just for consistency with the general `up` topic."}}
{"actor":{"display_login":"johanstokking"}}