realtime-py
realtime-py copied to clipboard
Unable to get realtime connection to Supabase locally
I am currently trying to use realtime.connection.Socket() with Supabase locally. I am following this guild (https://supabase.com/docs/guides/local-development). I am using a MacBook Pro with an M1 chip, realtime==0.0.4.
From the Supabase guide, I have run "supabase start" and "docker ps" in the terminal:

Sample code to run:
from realtime.connection import Socket
# local service key
SUPA_SERVICE_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSJ9.vI9obAHOGyVVKa3pD--kJlyxp-Z2zV9UUMAhKpNLAcU"
HOST_PORT = 54321
SUPA_REALTIME_URL = f"wss://localhost:{HOST_PORT}/realtime/v1/websocket?apikey={SUPA_SERVICE_KEY}&vsn=1.0.0"
s = Socket(SUPA_REALTIME_URL)
s.connect()
After running this code I get:

Could this be because of the SUPA_REALTIME_URL being incorrect? I have tried several different HOST_PORT shown in "docker ps" with no success.
Have you tried with the official supabase JS realtime library? I've never used Supabase locally to be honest
I have and it worked fine. My backend is mainly in python, so it would be convenient for it to work with python too.
@JamesLloydPartington did you ever figure this out?
@chitalian Unfortunately I have not.
oh my gosh @JamesLloydPartington you might facepalm at this one...
wss -> ws
however. I am running into another issue now lol https://github.com/supabase/realtime/issues/347
But I think you can probably close this issue :)
I do remember trying both wws and ws a while back. But neither of those worked. Since you have a new issue open, I'll close this one.
@JamesLloydPartington
I do remember trying both wws and ws a while back. But neither of those worked. Since you have a new issue open, I'll close this one.
Yeah they are actually going to get it to work here https://github.com/supabase/cli/pull/594
this should work, I got it to connect successfully. Let me know if you need any help running it locally :) for me it was just doing ws