You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Realtime only has a single socket even with different endpoints #102
val realtimeA = Realtime(clientA).subscribe(...)
val realtimeB = Realtime(clientB).subscribe(...)
👍 Expected behavior
It should create one socket per Client, or at most per endpointRealtime.
If I have multiple Client objects connected to different backends, I should be able to have a separate socket to each.
Simply changing
class Realtime ... {
private companion object {
private var socket: RealWebSocket? = null
to
private val sockets: Map<String, RealWebSocket> = mutableMapOf()
and making appropriate thread-safe changes to the few places sockets are created/destroyed would address this.
👎 Actual Behavior
It shares a single socket across all Client/Realtimes, as it puts the socket on a private companion object.
Thus when I create realtimeB and call subscribe, it will close the socket, and create a new socket to localhost:8088 but try to merge all the requests for updates together. It's possible there are different users on each backend, etc.
🎲 Appwrite version
Version 1.8.x
💻 Operating system
Linux
🧱 Your Environment
This is Kotlin using io.appwrite:sdk-for-android:11.4.0
Note that this is an unusual scenario to have multiple clients to multiple backends, but I'm designing a highly-resilient, client-driven multiple-backend project that can keep multiple backends in sync, so it's a requirement for my project.
👀 Have you spent some time to check if this issue has been raised before?
Activity