django / daphne

Django Channels HTTP/WebSocket server
BSD 3-Clause "New" or "Revised" License
2.32k stars 256 forks source link

wss:// Socket always in CONNECTING state #410

Closed sbalasa closed 2 years ago

sbalasa commented 2 years ago

Command issued in Browser console:

var socket = new WebSocket("wss://localhost:22600/ws/message/")
socket.onmessage = (message) => {console.log(message.data)}
socket.send('{"message": "This is a test"}')

Browser Console Error:

Uncaught DOMException: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
    at <anonymous>:1:8

Browser: Chrome, Safari, Ingonito mode too

pip3 freeze: channels==3.0.4 channels-redis==3.3.1 daphne==3.0.2

BE command: daphne -e ssl:443:privateKey=key.pem:certKey=cert.pem -b 0.0.0.0 -p 22600 my_project.asgi:application -t 60 -v 3