Closed
Description
Bug report
Describe the bug
I have setup realtime for a table in Supabase, but when connecting via the swift SDK, it always says isConnected = false on the client, and the subscription has isJoining = true but isJoined is always false.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Connect to supabase via the client
- Subscribe to a table with realtime on
- Never get isJoined or data passed down
Expected behavior
The subscription should show new changes in the subscription channel, when they are changed in the DB.
Code Snippet
private func subscribeToLocationChanges() {
do {
client.realtime.connect()
locationChannel = client.realtime
.channel(.table("profile_location", schema: "public"))
locationChannel?.on(.update) { message in
print(message)
/*
// Process the message and update the `currentLocation` property
if let data = message.payload["new"],
let location = try? JSONDecoder().decode(LocationModel.self, from: JSONSerialization.data(withJSONObject: data, options: [])) {
DispatchQueue.main.async {
self?.currentLocation = location
}
}*/
}
locationChannel?.onMessage { msg in
print(msg.payload)
return msg
}
locationChannel?.on(.insert) { message in
print("message")
}
locationChannel?.on(.join) {_ in
print("Successfully joined!")
}
locationChannel?.on(.heartbeat) {_ in
print("Successfully subscribed!")
}
locationChannel?.on(.error) { error in
print("Subscription error: \(error)")
}
locationChannel?.subscribe()
} catch {
print(error)
}
}
System information
- OS: Mac OS
- Version of supabase-swift: 0.3.0
- Version of realtime-swift: 0.0.2
Additional context
Add any other context about the problem here.