docs
docs copied to clipboard
Document local client lib channel enumeration in 'channels and messages'
channel enumeration is required by the feature spec (RST2), but currently missing from the documentation
@SimonWoolf I can add the docs, but JS does not support it currently does it without the .all hack, or is that the way it should be done?
@matthew.oriordan for channel in channels.all is the way it was designed to work, at least.
We can discuss changing it, but I suspect any way of making for channel in channels enumerate only channels is going to be horribly messy. (And TBH I wouldn't even call .all much of a hack, seems a clean enough solution to me -- I know it's not as nice as include Enumerable; def each ... end, but eh, that's javascript for you)
Replacing in favour of #251
AFAICS, https://github.com/ably/docs/issues/251 is about the active channel enumeration REST api that's in beta. That's not really anything to do with this issue, which is about RST2 iteration of the local client library Channels object to see what channels the client lib is currently using.
➤ Mike Clark commented:
Genius asked about (as per linked HubSpot ticket) how to see which channels are subscribed (attached) and the advice was to use channels.all https://github.com/ably/ably-js/blob/fdd5a566eafac0a7fae9592f890361a608794487/src/common/lib/client/realtime.ts#L56 ( https://github.com/ably/ably-js/blob/fdd5a566eafac0a7fae9592f890361a608794487/src/common/lib/client/realtime.ts#L56 )
The relevant information for this is missing on the channels API reference https://ably.com/docs/api/realtime-sdk/channels?lang=javascript#channels-object ( https://ably.com/docs/api/realtime-sdk/channels?lang=javascript#channels-object|smart-link ) which only gives details on two methods (get and release).
I think it would also be relevant to add details on how to use this somewhere in the https://ably.com/docs/channels ( https://ably.com/docs/channels|smart-link ) documentation
Mark Hulbert Making you aware as this caused some confusion with giving the customer accurate / best practice advice
cc Simon Woolf
➤ Mike Clark commented:
This was asked about by a customer on how to see which channels are subscribed (attached) and the advice was to use channels.all https://github.com/ably/ably-js/blob/fdd5a566eafac0a7fae9592f890361a608794487/src/common/lib/client/realtime.ts#L56 ( https://github.com/ably/ably-js/blob/fdd5a566eafac0a7fae9592f890361a608794487/src/common/lib/client/realtime.ts#L56 )
The relevant information for this is missing on the channels API reference https://ably.com/docs/api/realtime-sdk/channels?lang=javascript#channels-object ( https://ably.com/docs/api/realtime-sdk/channels?lang=javascript#channels-object|smart-link ) which only gives details on two methods (get and release).
I think it would also be relevant to add details on how to use this somewhere in the https://ably.com/docs/channels ( https://ably.com/docs/channels|smart-link ) documentation
Mark Hulbert Making you aware as this caused some confusion with giving the customer accurate / best practice advice
cc Simon Woolf