django / daphne

Django Channels HTTP/WebSocket server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wss:// Socket always in CONNECTING state

sbalasa opened this issue · comments

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