Just trying to do a basic connection to a self hos...
# help
t
Just trying to do a basic connection to a self hosted realtime server. Code:
Copy code
py
from realtime.connection import Socket


def callback1(payload):
    print("Callback 1: ", payload)


def callback2(payload):
    print("Callback 2: ", payload)


if __name__ == "__main__":
    URL = "ws://localhost:4000/socket/websocket"
    s = Socket(URL)
    s.connect()

    channel_1 = s.set_channel("realtime:public:todos")
    channel_1.join().on("UPDATE", callback1)

    channel_2 = s.set_channel("realtime:public:users")
    channel_2.join().on("*", callback2)

    s.listen()
Result:
Copy code
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 403
Server:
Copy code
2022-04-20 00:02:59.397 [info] REFUSED CONNECTION TO RealtimeWeb.UserSocket in 32µs

  Transport: :websocket

  Serializer: Phoenix.Socket.V1.JSONSerializer

  Parameters: %{}
What am I doing wrong here?
n
Hello @TUFFLES! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
t
Figured it out, the problem was I used the RLS version instead of the normal version. Whoops!
n
Thread was archived by @TUFFLES. Anyone can send a message to unarchive it.
TUFFLES (2022-04-20)