Skip to content

Commit

Permalink
fix weird problem with dev server django/daphne#345
Browse files Browse the repository at this point in the history
  • Loading branch information
jclgoodwin committed Dec 12, 2020
1 parent b5a0e96 commit 54961c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vehicles/routing.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
from django.urls import re_path
from django.core.asgi import get_asgi_application
from channels.routing import ProtocolTypeRouter, URLRouter, ChannelNameRouter
from vehicles import consumers, workers


application = ProtocolTypeRouter({
"http": get_asgi_application(), # this prevents weird problems with parallel requests with the development server

"websocket": URLRouter((
re_path(r'^ws/vehicle_positions$', consumers.VehicleMapConsumer.as_asgi()),
re_path(r'^ws/vehicle_positions/services/(?P<service_ids>[\d,]+)$', consumers.ServiceMapConsumer.as_asgi()),
re_path(r'^ws/vehicle_positions/operators/(?P<operator_id>[\w]+)$', consumers.OperatorMapConsumer.as_asgi()),
)),

"channel": ChannelNameRouter({
"sirivm": workers.SiriConsumer()
})
Expand Down

0 comments on commit 54961c5

Please sign in to comment.