diff --git a/README.md b/README.md index 5c9b2e3..aeda292 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,9 @@ await channel.send("your_handler", "this is my payload", ref) channel.off(None, ref, callback1) ``` +## Examples +see `usage.py`, `sending-receiving-usage.py`, and `fd-usage.py`. + ## Sample usage with Supabase Here's how you could connect to your realtime endpoint using Supabase endpoint. Should be correct as of 13th Feb 2024. Please replace `SUPABASE_ID` and `API_KEY` with your own `SUPABASE_ID` and `API_KEY`. The variables shown below are fake and they will not work if you try to run the snippet. diff --git a/sending-receiving-usage.py b/sending-receiving-usage.py index f39a2e7..597e24b 100644 --- a/sending-receiving-usage.py +++ b/sending-receiving-usage.py @@ -11,11 +11,9 @@ def callback2(payload): async def main(): # your phoenix server token - # TOKEN = "" - TOKEN = "SFMyNTY.g2gDYRRuBgBK_9yHjQFiAAFRgA.Fs-vgUBiBiSBtKq9qlKar8ny7SjO0ykXfaLUk2a1TMM" + TOKEN = "" # your phoenix server URL - # URL = f"ws://127.0.0.1:4000/socket/websocket?token={TOKEN}&vsn=2.0.0" - URL = f"ws://127.0.0.1:4000/feedsocket/websocket?token={TOKEN}&vsn=2.0.0" + URL = f"ws://127.0.0.1:4000/socket/websocket?token={TOKEN}&vsn=2.0.0" client = Socket(URL) @@ -26,8 +24,7 @@ async def main(): listen_task = asyncio.ensure_future(client.listen()) # join the channel - # channel = client.set_channel("this:is:my:topic") - channel = client.set_channel("feed:44") + channel = client.set_channel("this:is:my:topic") await channel.join() channel.on("test_event", None, callback1)