Comments (7)
(Generally, you don't want to route http.request
in the routing and just leave it out so it does the default, which is exactly what you want. You only need to route it yourself if you're doing something unusually low-level)
from channels.
Good point, I thought I had. Added a paragraph in there.
from channels.
@itsmehdi97 Take a look at the example here: https://channels.readthedocs.io/en/stable/topics/routing.html#urlrouter
It covers the exact use-case you're asking about.
from channels.
Yes, you can use the channels.handler.ViewConsumer
to pass any http.request
message into the view system, though this is done for you by default.
In addition, in the latest master code, the routing gains the ability to route to custom HTTP endpoints/WebSocket consumers based on url (path
), and will always fall back to Django's view handling if nothing processes a http.request
message.
from channels.
Got it, thanks! I just didn't find the docs section stating that this already happens by default. Thanks for the quick reply!
from channels.
Channels is looking really good this far. Perhaps explicitly add this to the starting section of the docs? I did not find it either so had to come here to find this out.
from channels.
Is it possible to process some of http requests by channels consumers and some of them by the traditional django views based on their url?
Actually I need to add a single endpoint that should be asynchronous - using consumers - and others are simple rest-framework views.
I thought this issue is related to my question but I couldn't find the channels.handler.ViewConsumer
you mentioned here .
from channels.
Related Issues (20)
- OriginValidator could raise exception/log message for denied connections HOT 1
- Unable to collect code coverage when using `ChannelsLiveServerTestCase` HOT 14
- error in channel layer explanations HOT 2
- adding a check if group_name exists method for channel_layer HOT 1
- Small messages are getting concatenated HOT 2
- How can I change the schema in the database? HOT 1
- How to test send_json() contents when passing close=True HOT 2
- Handler declaration by decorator/annotation (in order to prevent potential method leaks) HOT 1
- django-q2 and django-channels together HOT 1
- Channel Layer's group_send() Not Working When Called From Django View HOT 3
- Add CORs middleware HOT 1
- Breakage in routing.py on django/main pre-5.1.
- Use Django async-native APIs where possible HOT 9
- Django Channels Memory Leak on every message or connection HOT 27
- WARNING daphne.server ASGIStaticFilesHandler WebRequest took too long to shut down and was killed HOT 4
- Use group_send() when group is empty HOT 1
- Session Data Corrupted HOT 1
- Error with send_json Function in AsyncJsonWebsocketConsumer HOT 6
- Getting TypeError: SSEConsumer() missing 2 required positional arguments: 'receive' and 'send'
- django.core.exceptions.SynchronousOnlyOperation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from channels.