I have at my django project a socket server django-socketio (that works normally), and i try to send message message for it by using the following code:
import socket
import json
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1' , 9000))
data = {
'username': 'avt',
'password': 123,
'amount': 100
}
message = json.dumps(data)
s.sendall(message)
And receive error:
<socket fileno=5 sock=127.0.0.1:9000 peer=127.0.0.1:58952>: Invalid HTTP method: '{"username": "avt", "amount": 100, "password": 123}'