docs icon indicating copy to clipboard operation
docs copied to clipboard

Add `setOptions` to the list of channel methods in the api docs

Open SimonWoolf opened this issue 4 years ago • 6 comments

Why isn't setOptions in the list of channel methods in the api docs? https://ably.com/documentation/realtime/channels#publish

It's described in https://ably.com/documentation/realtime/channels#modifying-options , just not listed in the actual methods list

Also, https://ably.com/documentation/realtime/channels#get should list the options parameter as optional, and note that get() shouldn't be used to modify the options of an existing channel, should use channel.setOptions instead

┆Issue is synchronized with this Jira Bug by Unito ┆Attachments: image-20221029-060232.png

SimonWoolf avatar Mar 22 '21 13:03 SimonWoolf

Also see RSN3c where we document that setting channel options when getting a channel is to avoided:

Note that this is soft-deprecated and may be removed in a future release, so should not be implemented in new client libraries. The supported way to update a set of ChannelOptions is Channel#setOptions

Therefore, I wonder whether we should be promoting the use 'set on get' at all ... i.e. at 2.1 (a) Setting channel options we should not say there's two ways, instead pushing users to set options after channel creation. That is assuming I'm not missing anything in respect of the motivation for the addition of the 'pure channel options set' API. 🤔

QuintinWillison avatar Jan 13 '22 10:01 QuintinWillison

yep, sounds good.

My motivation for adding that bit to RSN3c was pretty much that I dislike channels#get(name, options) because it feels like a functional API, but it doesn't work like one. Like: it seems intuitive that if you do

one = Channels.get('test', options_one)
two = Channels.get('test', options_two)

then you should get a one channel object that uses the first set of options and a two object that uses the second set. But what you actually get is two references to at same channel object, which uses options_two.

If setOptions is split off, it makes it a bit more obvious that this is not a functional API, and that Channels.get just returns references to a single underlying object, which can be modified with setOptions.

SimonWoolf avatar Jan 13 '22 11:01 SimonWoolf

In passing I noticed that the 3.1 Example here uses channels.get, specifying channel options.

It also uses the word "modify" when it then goes on to illustration channel.setOptions which I think is potentially misleading.

QuintinWillison avatar Aug 15 '22 08:08 QuintinWillison

➤ Tony Bedford commented:

As the page has been split, see: https://ably.com/docs/api/realtime-sdk/channels ( https://ably.com/docs/api/realtime-sdk/channels|smart-link ) for the API reference docs.

ably-sync-bot avatar Oct 28 '22 10:10 ably-sync-bot

➤ Tony Bedford commented:

Note, it’s actually a Channels method, not Channel method.

ably-sync-bot avatar Oct 28 '22 11:10 ably-sync-bot

➤ Tony Bedford commented:

Mark Monaghan - I think would be a good first bug to take a look at. It’s just adding a method to the API reference. This should be a good way of getting familiar with our processes. Thanks.

ably-sync-bot avatar Oct 28 '22 11:10 ably-sync-bot