realtime-swift
realtime-swift copied to clipboard
Realtime Presence feature
Feature request
Is your feature request related to a problem? Please describe.
I'm developing an App where it is important to have real-time knowledge of which users are in which parts of the app. I was planning of doing this using the realtime presence capabilities from supabase.
Describe the solution you'd like
I'm looking for an API that allows to use the presence capabilities from supabase.
Describe alternatives you've considered
I've considered no alternatives.
Additional context
I've been trying to follow this guide, https://supabase.com/docs/guides/realtime/presence to create a Swift realtime presence feature on my app.
var channel = realTimeClient.channel(.schema("public"), params: ["presence":"user1"])
channel.onMessage { message in
print("message: \(message.payload)")
return message
}
channel.push(.join, payload: ["presence":"user2"])
channel.subscribe()
For example, with something like this, I receive the following error:
Realtime/Channel.swift:466: Fatal error: Tried to push join to schema("public") before joining. Use channel.join() before pushing events`` However, the channel has no public
.join` method.
One of the issues is that the endpoint being used for realtime is v1
. Are there any plans to update it to v2
?
Maybe I'm interpreting this in a wrong manner and it is already possible to have a presence feature implemented with the current version of supabase-swift
.
Thank you :)
@miguel-arrf hey Miguel. The Supabase Swift library has got real time capabilities.
The Swift Docs over here as has examples: https://supabase.com/docs/reference/swift/subscribe
Please take a look and let me know if this helps.
Hi @maail ! Thank you for the reply!
The feature that I think is missing (as least it was) is Realtime Presence.
I've implemented this in my app by embeding a WebView with the JS supabase library that can then communicate with my app. It's an ugly workaround, but one that works.
If still in need try update-upstream
branch (see #26)