Skip to content

Automatically inject options into Channel #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

foodisbeast
Copy link

What kind of change does this PR introduce?

feature, add docs

What is the current behavior?

Channel initializer has parameter params of type [String:Any]. When params is unset this prevents channel Presence from receiving sync events. See my earlier comment in discussion #21 for more details.

What is the new behavior?

Channel initializer has new parameter options of type ChannelOptions allowing Presence to receive sync events by default.

Additional context

ChannelOptions was generated using types found in RealtimeChannelOptions

@@ -594,9 +611,10 @@ public class RealtimeClient: TransportDelegate {
/// - parameter topic: Topic of the channel
/// - parameter params: Optional. Parameters for the channel
/// - return: A new channel
@available(*, deprecated, renamed: "channel(_:options:)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we really deprecate this?

aren't there other params that can be passed other than ChannelOption? Having this raw [String: Any] I think is still valid.

I'm not sure about this because I'm not used to the realtime feature, what do you think @foodisbeast ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless this package is meant to support Phoenix realtime generally, supabase realtime or realtime-js library only has these options available for initializing a channel (See RealtimeChannelOptions from realtime-js), as well as their documention for realtime only makes mention/use of RealtimeChannelOptions once when talking about Presence Key

import { createClient } from '@supabase/supabase-js'

const channelC = supabase.channel('test', {
  config: {
    presence: {
      key: 'userId-123',
    },
  },
})

@grdsdev grdsdev merged commit 1dddd79 into supabase-community:update-upstream Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants