I coded a simple app that connects to one supabase client and leverages the postgres_extension
to listen for chnages of a particular table. This is a simple nodejs application like the one shown in the docs here: https://supabase.com/docs/guides/realtime
Question - and maybe this is not a supabase specific question but rather a websocket/Phoenix/Elixir
question.
Can I instantiate multiple supabase clients in the same nodejs
application each subscribing to its own topics? sort of like listening to multiple "rooms" at the same time from within the same app.. Multiple supabase client is a requirement (as the events would come from different supabase accounts).
Is this possible? is it only a matter of just instantiating another client and listen for events?
supabase_new_client
.channel('new_channel')
.on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'todos' }, handleInserts)
.subscribe()
Wonder what sort of perf issues will I encounter on the machine where this is deployed?
As a follow up, are there any best practices for how to handle if a connection is lost or something went wrong with the channel connection? So that I can restart it for example?