1024programmer Java DjangoChannelsServer configuration: Ubuntu. Handshake 404

DjangoChannelsServer configuration: Ubuntu. Handshake 404

I’m trying to configure a Django channel to run on my ubuntu server (Digital Ocean).

My Redis server is running port 6379. Daphne endpoint listens to unix:/home/mysite/sockets/mysite.sock with HTTP/2 support enabled (not sure, needed at this stage) I also have a ./manage.py runworkerListening. My daphne running command is

daphne -u /home/mysite/sockets/mysite.sock project.asgi:channel_layer
 

My http request goes through (in daphne log), just like in local environment

#local
 127.0.0.1:62241 - - [09/Oct/2017:21:03:41] "GET /playground/channel-simple" 200 1826

 #server (side note. not sure why port + host are eliminated here.?)
 None - - [09/Oct/2017:21:53:51] "GET /playground/channel-simple" 200 1622
 

But when I request the websocket URL via js, everything crashes…

#local
 127.0.0.1:62268 - - [09/Oct/2017:21:03:43] "WSCONNECTING /chat/private-room/" - -
 127.0.0.1:62268 - - [09/Oct/2017:21:03:43] "WSCONNECT /chat/private-room/" - -

 #server
 None - - [09/Oct/2017:21:54:04] "GET /chat/private-room/" 404 86
 

Seems like the request is being treated as an http request rather than a websocket connection? This is also the js console log…

#server - js response to connection
 WebSocket connection to 'ws://[MY-IP]/chat/private-room/' failed: Error during WebSocket handshake: Unexpected response code: 404
 

Can anyone suggest where to fire this 404? Or any tips on debugging.

Thank you.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/770310

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索