DJANGO CHANNELS教程(V2)-實時-WebSockets-非同步
1-歡迎(0:00:00)
2-要求(0:49:22)
3-安裝和集成通道(0:01:38)
4-您的第一個消費者(0:05:47)
5-路由您的WebSocket(0:10:41)
6-帶JavaScript的WebSocket(0:17:22)
7-接受WebSocket連接(0:23:25)
8-用戶和資料庫對象(0:27:08)
9-使用JavaScript發送數據(0:31:09)
10-回聲消息(0:39:00)
11-顯示消息(0:43:23)
12-整合Redis(0:50:25)
13-創建聊天室(0:54:24)
14-重新連接並保存(1:04:30)
ChatXChannels課程:https://kirr.co/vmd13r
代碼:https://github.com/codingforentrepreneurs/Rapid-ChatXChannels
訂閱:http://joincfe.com/youtube
專業人士:http://kirr.co/ni5fia。
ASGI alone is not good enough, especially for production level. it is better to use both. WSGI for http and asgi for websocket
why i need to refresh the page to see the new message? https://stackoverflow.com/questions/60277130/django-chat-app-dont-need-to-refresh-to-read-the-message
I'm late to this party, but great video.
i have the same directory structure as this tutorial but "from chat.consumers import ChatConsumer" is prompted to be incorrect in my pycharm, what am i doing wrong??
when i tried to import chat in routing.py pycharm does not recognise it, so i had to go one level up "from ..chat.consumers import "ChatConsumers" it correctly imported but at running runserver it says 'beyond top level package error in relative import " can somebody please help me :'(
After many tutorials I have been reading on the internet about channels, this was the best by far. It's very clear and everything used/showed in the video is explained. Thank you! I can now correctly understand and control WebSocket with Channels! If I can just add a small remark, it would explain why you choose to use "AsyncConsumer" more than "AsyncWebsocketConsumer" or "AsyncJsonWebsocketConsumer" and the difference between each of them (useful to understand with one is "low level" for the others one, etc…)
i love u man
Please tell the solution for warning that comes in your console. I am having the same warning.
45:32
If you are trying to put this into production by using uvicorn and are getting the following error "Django can only handle ASGI/HTTP connections, not websocket." its because you should call get_default_application() from the channels.routing instead of get_asgi_application() from the django core. (ps: You have to call django.setup() before)
Great Tutorial. Thank you so much 🙂
Error occoured
No route for `messages/biv123`
my best Django Tutor
I love this lesson so much
bro you are best (y)
Great video.
Pleaseake an indepth video of django signals, celery, memcaching etc
Did I miss something? Where did you created this input in template? When did you create those models in models.py?
I also check your github and it is not working like here on video.
Am i miss something?
please sir help me google colud problem this
failed: Error during WebSocket handshake: Unexpected response code: 404
Can you please help me? whenever I am doing socket.send, I am getting this error. I am unable to track the reason of the error and I have been at it for hours. I am at 34:25 and unable to go into websocket_recieve method
Exception inside application: No handler for message type websocket.receive
File "E:pythonprojectsRapid-ChatXChannelssrcvenvlibsite-packageschannelssessions.py", li
ne 183, in _call_
return await self.inner(receive, self.send)
File "E:pythonprojectsRapid-ChatXChannelssrcvenvlibsite-packageschannelsmiddleware.py",
line 41, in coroutine_call
await inner_instance(receive, send)
File "E:pythonprojectsRapid-ChatXChannelssrcvenvlibsite-packageschannelsconsumer.py", li
ne 59, in _call_
[receive, self.channel_receive], self.dispatch
File "E:pythonprojectsRapid-ChatXChannelssrcvenvlibsite-packageschannelsutils.py", line
52, in await_many_dispatch
await dispatch(result)
File "E:pythonprojectsRapid-ChatXChannelssrcvenvlibsite-packageschannelsconsumer.py", li
ne 75, in dispatch
raise ValueError("No handler for message type %s" % message["type"])
No handler for message type websocket.receive
Thanks Justin for another amazing work!
Anyone here still not understand the Channels? :<
What lead you to the conclusion that you'd have to create the `chat_message` method? 1:00:14
how to install redis on windows ?
How can I use the same channel in diferent websocket servers? (many clients send messages via separared websocket server, but the same channel)
How to create drf for this????
Thanks ??
I cant find the complete file on your github repo
God, I started with you the path to django and python, from the blog on django, I took that code style from you) and so far it is everywhere with me, I remember asking you to do a tutorial on channels for a long time ago, unfortunately I saw it just now) it was over errors that did not occur to you, the same with the output to the browser console, but as before thanks to you, I sat and dig it and found the answers) one of them is now on the stack. https://stackoverflow.com/questions/57443549/no-handler-for-message-type-websocket-group-send-how-to-fix/57462779#57462779
Thank you, love you)
Great video! Thnx. can you share the finished code please?
Could you do a tutorial using Mqtt broker, like mosquitto?
Hello, have you any material about notification users for new messages with channels django?
thanks bro !!!1! keep up the good work 😉
Thank's for this detailed tutorial 🙂 it's very usefull and helped me to understand all)
Please i would love to see the tutorial of how you created the chat form. Please share the link so as i can follow along with great tutorial
any ideas why i get a 200?
[Log] Location {href: "https://plaagsex.nl/", protocol: "https:", host: "plaagsex.nl", hostname: "plaagsex.nl", port: "", …} (plaagsex.nl, line 3)
[Error] WebSocket connection to 'wss://plaagsex.nl/' failed: Unexpected response code: 200
[Log] error – Event {isTrusted: true, type: "error", target: WebSocket, …} (plaagsex.nl, line 24)
Event {isTrusted: true, type: "error", target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}Eventbubbles: falsecancelBubble: falsecancelable: falsecomposed: falsecurrentTarget: nulldefaultPrevented: falseeventPhase: 0isTrusted: truereturnValue: truesrcElement: WebSocket {URL: "wss://plaagsex.nl/", url: "wss://plaagsex.nl/", readyState: 3, bufferedAmount: 0, onopen: function, …}WebSockettarget: WebSocket {URL: "wss://plaagsex.nl/", url: "wss://plaagsex.nl/", readyState: 3, bufferedAmount: 0, onopen: function, …}WebSockettimeStamp: 76type: "error"Event PrototypeAT_TARGET: 2BUBBLING_PHASE: 3CAPTURING_PHASE: 1NONE: 0bubblescancelBubblecancelablecomposedcomposedPath()constructor: function()currentTargetdefaultPreventedeventPhaseinitEvent(type, [bubbles], [cancelable])preventDefault()returnValuesrcElementstopImmediatePropagation()stopPropagation()targettimeStamptypeObject Prototype
[Log] close – CloseEvent {isTrusted: true, wasClean: false, code: 1006, …} (plaagsex.nl, line 28)
CloseEvent {isTrusted: true, wasClean: false, code: 1006, reason: "", type: "close", …}CloseEvent
Best Channels tutorial on the web. Good Job Guys, keep it up!
Hello Justin. Please do you have any guide on how to deploy django channels on webfaction?
Awesome… thanks mate
The git reset line for the set up does not work?
Also what's the difference between using ReconnectingWebsocket and webSocketBridge?
I have a basic query, The get_or_new method in the ThreadManager returns none if the username in the url and the logged in user are the same which will display the page not ound error message. Then how are you on the page 127.0.0.1/messages/cfe? I would understand if this has been abstracted so that people can join your course 🙂
Great Video Justin! Been with you since 2015 and it's been awesome as ever!.
Keep up the awesome work!
Quick question; how would you take this further to send notifications to said users about the availability of new messages?
Hi All, I don't see any setting of channel layer here, does the new channels library manage this under the hood? or the channel layer is optional? Can some one explain please
I have already made an application WSGI can I integrate chat application into that project
I have a big problem, and I don't know what it is… basically I'm trying to run some pipeline, that I have to run scripts in R and Perl, and give some feedback link "this script have Start", "This script is complete", "Now startting script in R", and this pipeline is SYNC, and the feedback isn't comming one by one, it's more like a massive block at one.
I was clear (I hope so…)?
Maybe instead of using virtualenv etc, rather just use the python:3.6 Docker?
Awesome bud btw. been using Django for years and decided to try out channels and this video made it super easy
Very good tutorial on django channels with step by step guide. Thank you!
Why does clicking "Submit" redirect me to "/messages" and not to "/messages/username" ?
you make it seem like its so simple but you're skipping over a lot of details and youre not showing how channels works but how to make that project. Please show how channels and what it does and tries to do at every step. this video does not help as much because through this i dont understand what channels is actually doing and i dont know the flow of channels
bro , ur the great one!