{"action":"created","issue":{"url":"https://api.github.com/repos/ably/docs/issues/67","labels_url":"https://api.github.com/repos/ably/docs/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/ably/docs/issues/67/comments","events_url":"https://api.github.com/repos/ably/docs/issues/67/events","html_url":"https://github.com/ably/docs/issues/67","id":118268810,"number":67,"title":"Question about RTP8g (presence#enter on a DETACHED channel)","user":{"login":"SimonWoolf","id":5908687,"avatar_url":"https://avatars.githubusercontent.com/u/5908687?v=3","gravatar_id":"","url":"https://api.github.com/users/SimonWoolf","html_url":"https://github.com/SimonWoolf","followers_url":"https://api.github.com/users/SimonWoolf/followers","following_url":"https://api.github.com/users/SimonWoolf/following{/other_user}","gists_url":"https://api.github.com/users/SimonWoolf/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonWoolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonWoolf/subscriptions","organizations_url":"https://api.github.com/users/SimonWoolf/orgs","repos_url":"https://api.github.com/users/SimonWoolf/repos","events_url":"https://api.github.com/users/SimonWoolf/events{/privacy}","received_events_url":"https://api.github.com/users/SimonWoolf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ably/docs/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-22T15:30:27Z","updated_at":"2015-11-22T22:18:46Z","closed_at":null,"body":"So `RTP8g` says that the client lib, for Presence#enter, `Raises an exception if the channel is DETACHED or FAILED`.\r\n\r\nThis seems inconsistent with other actions that trigger an implicit attach (eg channel#publish), for which the client lib triggers an implicit attach for a `detached` channel just as for an `initialized` one. Presence#enter is the only action that has both an `Implicitly attaches to the channel if not attached` and a `Raises an exception if the channel is DETACHED or FAILED` requirement (the only other action that has the latter is `Presence#get`, which does not have an implicit attach requirement).\r\n\r\nCurrent client lib behaviour: ably-js treats `detached` and `initialized` channels the same for all of these, and implicitly attaches. Ably-ruby has all presence broadcast-type actions raising an exception if called on a `detached` channel.\r\n\r\nNot obvious to me why implicit attaching should behave differently between presence actions and others.\r\n\r\n(Also for realtime presence#get: if we don't want to make it an implicit-attach action, shouldn't it raise an exception if in any state other than `attached`, not just `detached` or `failed`?)"},"comment":{"url":"https://api.github.com/repos/ably/docs/issues/comments/158808271","html_url":"https://github.com/ably/docs/issues/67#issuecomment-158808271","issue_url":"https://api.github.com/repos/ably/docs/issues/67","id":158808271,"user":{"login":"mattheworiordan","id":43789,"avatar_url":"https://avatars.githubusercontent.com/u/43789?v=3","gravatar_id":"","url":"https://api.github.com/users/mattheworiordan","html_url":"https://github.com/mattheworiordan","followers_url":"https://api.github.com/users/mattheworiordan/followers","following_url":"https://api.github.com/users/mattheworiordan/following{/other_user}","gists_url":"https://api.github.com/users/mattheworiordan/gists{/gist_id}","starred_url":"https://api.github.com/users/mattheworiordan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattheworiordan/subscriptions","organizations_url":"https://api.github.com/users/mattheworiordan/orgs","repos_url":"https://api.github.com/users/mattheworiordan/repos","events_url":"https://api.github.com/users/mattheworiordan/events{/privacy}","received_events_url":"https://api.github.com/users/mattheworiordan/received_events","type":"User","site_admin":false},"created_at":"2015-11-22T22:18:46Z","updated_at":"2015-11-22T22:18:46Z","body":"Ok, so my view is that implicit attach should only happen the first time a channel is accessed i.e. when it is initialised.  If it is has been detached manually by the developer, then I don't think it should reattach without an explicit request to do so.  So if there are inconsistencies in this, we should fix it in the spec.\r\n\r\nIn regards to whether `Presence#get` should implicitly attach, I think it should.\r\n\r\nSo my vote would be to ensure consistency in the spec for `Realtime.Channel#subscribe`, `Realtime.Channel#publish`, `Realtime.Presence#enter*`, `Realtime.Presence#leave*`, `Realtime.Presence#update*` in that:\r\n\r\n* Calling the method implicitly attaches the channel if the channel is `INITIALISED`\r\n* Raises an exception if the channel is `DETACHED` or `FAILED`"}}