-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to use channels to SEND from Python to Phoenix? #39
Comments
What are you trying to achieve? I'm not very knowledgeable with supabase realtime but I thought it only supported sending you realtime updates as they happen to the database, what functionality exists that would need you sending something to the phoenix server? |
Phoenix has fully bidirectional clients for multiple languages but none for python. This seems the closest but is unidirectional. I wish to communicate from python to phoenix both ways and this library looks like a good starting point. My use case is unrelated to supabase. |
Ah got it. This repo has sort of been on the backburner for us while we worked on the other supabase - python features, hence the lack of features. Sadly I don't have the time right now to implement this feature, but I'd be happy to review and merge any PRs. Unrelated but I am curious -- does your usecase leverage asyncio, or is it all sync code? I ask this because right now this project does some hacky stuff to provide a sync interface to the otherwise async |
I'm quite happy to go fully async, so if you wanted to let me know where the hacks are, also happy to take a look at those. I will take a stab at putting in some basic bidirectionality too. |
@vegabook searching for |
@vegabook Have you found a viable solution for this? I'll be giving https://github.com/wwww-wwww/phxsocket a whirl this weekend, as I also need a bidirectional Phoenix Channel client. |
@silentsilas Did you manage to make phxsocket work with supabase? |
Ah I just needed to be able to run a Python script, and send/receive messages from it. Elixir's Port ended up doing the job without needing to modify my scripts to use Websockets. |
Is it possible to have a channe.send() script? I'm not familiar with the Websocket structures Supabase uses, I tried to run a simple "websocket.send" using URL = f"wss://{SUPABASE_ID}.supabase.co/realtime/v1/websocket?apikey={API_KEY}&vsn=1.0.0"
# Create a WebSocket connection to the specified URL
ws = websocket.WebSocket()
ws.connect(URL)
# Send a message over the WebSocket connection
ws.send("Hello, World!") 🔼 this is received by supabase's server (I can see the number of messages being increased) but the other Python client doesn't see these messages
|
We need this. For Python to be on the backburner is not great. I will dedicate work to this but it's difficult to know exactly what supabase is expecting. Websockets are not hard. I wish the site had a raw Websockets version of the docs. Can we at least get that? edit: just reversing the js client |
Did you have any luck with this? |
Can't we just add
Wouldn't that do the job? |
I think it implemented in #68 |
Using this blog I implemented it myself from scratch and it works very well. |
This issue is stale because it has been open for 365 days with no activity. |
Documentation and examples show how to listen from messages from Phoenix, but sending to phoenix is not documented, nor is it clear that this is even possible.
As you can see Python inspect module does not show anything on channel chan1 that might look like a method for sending. Could you elucidate on if / how one can use this library for two-way comms? Thanks.
The text was updated successfully, but these errors were encountered: