Skip to content

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

/// - 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