'Sending data through websocket in Python doesn't give the expected result

Thank you for reading this, I really appreciate any answers!

So I created a websocket connection, Then I listened and got a response with ws.recv(), now I need to send data to the server but it's in this format: 42["jwtToken",{"token":"somerandomjwttoken"}] How I'd send it:

ws = create_connection(...)
ws.send(json.dumps(["jwtToken",{"token":"somerandomjwttoken"}])
print(ws.recv()) #doesn't even print anything

I've tried a lot, and it doesn't give me the reply I want when I do ws.recv() afterwards. If anyone knows what I'm doing wrong, I'd really appreciate it :) Have a good day!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source