Closed Player-14 closed 2 months ago
It's not a bug, its a feature. This won't be changed until we find a way to make websockets work without asyncio.
Where is the async python client even documented? I can't for the life of me find it.
EDIT:
So it turns out the async client is pretty much undocumented and any documentation regarding the realtime functionality of the python package on the main supabase docs site is also outdated/wrong.
I finally found this half-decent example: https://github.com/supabase/realtime-py/blob/main/example/app.py#L66.
Example using supabase-py
:
supabase: AClient = await acreate_client(getenv("SUPABASE_URL"), getenv("SUPABASE_KEY"))
def my_callback(payload):
print(payload)
await supabase.realtime.connect()
await (supabase.realtime
.channel("my_channel")
.on_postgres_changes("*", schema="public", table="my_table", callback=my_callback)
.subscribe())
await supabase.realtime.listen()
Don't forget the await supabase.realtime.listen()
at the end, took me hours of debugging strange timeout errors to realize this is required!
Bug report
Describe the bug
Realtime is not available when using the sync client in supabase-py. The traceback is:
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Expected behavior
The module should just subscribe to the channel without tracebacks.
System information
Additional context
I am aware that realtime is available in the async class, but I prefer the sync class for ease of use.