Skip to content

Realtime allows multiple subscriptions to table #127

@GaryAustin1

Description

@GaryAustin1

Bug report

Documentations for realtime.js says:

Duplicate Join Subscriptions
While the client may join any number of topics on any number of channels, the client may only hold a single subscription for each unique topic at any given time. When attempting to create a duplicate subscription, the server will close the existing channel, log a warning, and spawn a new channel for the topic. The client will have their channel.onClose callbacks fired for the existing channel, and the new channel join will have its receive hooks processed as _normal.

Currently creating additional subscriptions to same table (or same table and exact filter) generate a new subscription.

To Reproduce

create multiple subscriptions to the same table and filter

Expected behavior

Based on the documentation, and I think the intent of the code, reusing a subscription should not create a new one.
I assumed it would so do not keep track of closing subscriptions when I renew.

This obviously can be handled by keeping track of subscriptions and closing them, but is a waste if realtime.js is supposed to handle it.
When dealing with connections going online and offline part of my code restarts subscriptions as part of a bigger block of code to reload the data being monitored in realtime as it state is no longer valid if connection goes offline.

Screenshots

realtime connections

duplicate connections on socket

System information

supabase 1.29.1

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions