from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("chat.routing.routing"), ]
from channels import include channel_routing = [ include('chat_room.routing.channel_routing', path=r'^/chat_room/'), include('friendship.routing.channel_routing', path=r'^/friendship/'), include('video_room.routing.channel_routing', path=r'^/video_room/'), ]
from channels import include, routing from tntapp.consumers import ws_connect, ws_receive, ws_disconnect ws_routing = [ routing.route("websocket.connect", ws_connect), routing.route("websocket.receive", ws_receive), routing.route("websocket.disconnect", ws_disconnect), ] channel_routing = [ include(ws_routing, path=r"^/sync"), ]
from channels import include channel_routing = [ include("app.productos.marca.routing.websocket_routing", path=r'^/marca'), include("app.productos.producto.routing.websocket_routing", path=r'^/producto'), include("app.cliente_proveedor.proveedor.routing.websocket_routing", path=r'^/proveedor'), include("app.cliente_proveedor.cliente.routing.websocket_routing", path=r'^/cliente'), include("app.alertas.routing.websocket_routing", path=r'^/alertas'), include("app.sistema.bodega.traslados.routing.websocket_routing", path=r'^/inter_tiendaas'), include("app.imprimir.routing.websocket_routing", path=r'^/cola'), include("app.sistema.usuarios.routing.websocket_routing", path=r'^/salarios'), ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("newsletter.routing.websocket_routing", path=r"^/chat/stream"), # Custom handler for message sending (see Room.send_message). # Can't go in the include above as it's not got a `path` attribute to match on. include("newsletter.routing.custom_routing"), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. ]
from channels.routing import route from channels import include channel_routing = [ include("chat.routing.websocket_routing", path=r"^/ws/chat"), include("chat.routing.custom_routing"), include("monitor.routing.websocket_routing", path=r"^/ws/monitor"), include("monitor.routing.custom_routing"), #include("tracker.routing.websocket_routing", path=r"^/tracker/stream"), include("tracker.routing.websocket_routing", path=r"^/ws/tracker"), include("tracker.routing.custom_routing"), ]
from channels import include channel_routing = [ include('chat.routing.chat_routing', path=r'^/chat/'), include('chat.routing.event_routing'), include('chat.routing.binding_routing'), ]
from channels import include channel_routing = [ include("mainserver.routing.websocket_routing", path=r"^/chat/stream"), # include("talk.routing.custom_routing"), ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("chess_tournament.routing.websocket_routing", path=r"^/api/tournament"), include("chess_tournament.routing.custom_routing"), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. ]
from channels import include channel_routing = [ include("app1.routing.post_websocket", path=r"^/app1/posts/notification"), include("app1.routing.vote_websocket", path=r"^/app1/votes/notification"), ]
# coding=utf-8 from __future__ import unicode_literals from channels import include from chat.routing import routing as chat_routing from collaborate_editor.routing import routing as collaborate_editor_routing routing = [ include(chat_routing, path=r'chat'), include(collaborate_editor_routing, path=r'^collaborate_editor'), ]
from channels import include import chat import forum import waiting_room channel_routing = [ include("chat.routing.channel_routing",path=r'^/chat/'), include("forum.routing.channel_routing",path=r'^/forum/'), include("waiting_room.routing.channel_routing",path=r'^'), ]
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals from channels import include from knocker.routing import channel_routing as knocker_routing from djangocms_blog.liveblog.routing import channel_routing as djangocms_blog_routing channel_routing = [ include(djangocms_blog_routing, path=r'^/liveblog'), include(knocker_routing, path=r'^/knocker'), ]
from channels import include from channels import route channel_routing = [ include("messanger.routing.websocket_routing", path=r"^/messanger/stream"), include("messanger.routing.custom_routing"), ]
from channels import include from channels.routing import route from musette import consumers # Comment topic comment_topic_ws = [ route("websocket.connect", consumers.ws_connect_comment_topic), route("websocket.disconnect", consumers.ws_disconnect_comment_topic), ] # Timeline profile user notification_ws = [ route("websocket.connect", consumers.ws_connect_notification), route("websocket.disconnect", consumers.ws_disconnect_notification), ] channel_routing = [ # Comments include("musette.routing.comment_topic_ws", path=r"^/ws/comment$"), # Notification include("musette.routing.notification_ws", path=r"^/ws/notification$"), ]
from channels import route, include def message_handler(message): print(message['text']) channel_routing = [ include('apps.Message.routing.websocket_routing', path=r"^/message/stream"), include('apps.Message.routing.custom_routing'), ]
from channels import include from channels.routing import route from canal import consumers message_routing = [ route("websocket.connect", consumers.ws_connect), route("websocket.receive", consumers.ws_message), route("websocket.disconnect", consumers.ws_disconnect), ] long_task_routing = [ route("websocket.connect", consumers.ws_connect), route("websocket.receive", consumers.slow_ws_message), route("websocket.disconnect", consumers.ws_disconnect), ] channel_routing = [ route("chat-messages", consumers.msg_consumer), route("slow-chat-messages", consumers.slow_msg_consumer), include("canal.routing.message_routing", path=r"^/chat"), include("canal.routing.long_task_routing", path=r"^/second-chat"), ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the xo_app module. channel_routing = [ # Include sub-routing from an app. include("xo_app.routing.websocket_routing", path=r"^/xo/stream"), # Custom handler for message sending (see Room.send_message). # Can't go in the include above as it's not got a `path` attribute to match on. include("xo_app.routing.custom_routing"), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. ]
# -*- coding:utf-8 -*- # !/usr/bin/env python # Time 18-1-11 # Author Yo # Email [email protected] from __future__ import absolute_import,unicode_literals import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "deveops.settings") #这里填的是你的配置文件settings.py的位置 from manager.urls.socket_urls import manager_routing from channels import include routing = [ #route("http.request", consumers.http_consumer), 这个表项比较特殊,他响应的是http.request,也就是说有HTTP请求时就会响应,同时urls.py里面的表单会失效 include(manager_routing, path=r'^/manager'), ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("wedraw.routing.websocket_routing", path=r"^/chat/"), # Custom handler for message sending (see Room.send_message). # Can't go in the include above as it's not got a `path` attribute to match on. include("wedraw.routing.custom_routing"), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. ]
from channels import include from DjangoSubscriptions.graphql.routing import app_routing channel_routing = [ include("DjangoSubscriptions.graphql.routing.app_routing", path=r"^/subscriptions"), ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("RoomApp.routing.websocket_routing", path=r"^/room/(?P<room_id>\d+)"), include("RoomApp.routing.room_routing") ]
from channels import include channel_routing = [ include("chat.routing.chat_routing", path=r"^/chat/(?P<room_name>[a-zA-Z0-9_]+)/$"), include("chat.routing.chat_room_routing", path=r"^/user_rooms/(?P<some_user>[a-zA-Z0-9_]+)/$"), include("user_page.routing.user_page_routing", path=r"^/user_page/(?P<some_user>[a-zA-Z0-9_]+)/$"), ]
from channels.routing import route, route_class from kidKnowGarden.consumers import * from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("kidKnowGarden.routing.websocket_routing", path=r"^/chat/stream"), # Custom handler for message sending (see Room.send_message). # Can't go in the include above as it's not got a 'path' attribute to match on. include("kidKnowGarden.routing.custom_routing"), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. ]
from channels import include from django.urls import path channel_routing = [ # Include subrouting from an app with predefined path matching. include("bitpoint.messenger.routing.websocket_routing", path=r"^/") ]
from channels.routing import route from channels import include from .consumers import chat_connect, chat_disconnect, chat_receive, loadhistory_connect, loadhistory_disconnect, \ loadhistory_receive chat_routing = [ route("websocket.connect", chat_connect), route("websocket.receive", chat_receive), route("websocket.disconnect", chat_disconnect) ] loadhistory_routing = [ route("websocket.connect", loadhistory_connect), route("websocket.receive", loadhistory_receive), route("websocket.disconnect", loadhistory_disconnect) ] channel_routing = [ include(chat_routing, path=r"^/ws/$"), include(loadhistory_routing, path=r"^/loadhistory/$"), ]
from channels import include, route from api.views.web_socket import ChatSocketView, CompositionSocketView composition_routing = [ route("websocket.connect", "api.consumers.base.pass_message"), route("websocket.receive", CompositionSocketView.as_view()), route("websocket.disconnect", CompositionSocketView.as_view()), ] chat_routing = [ route("websocket.connect", "api.consumers.base.pass_message"), route("websocket.receive", ChatSocketView.as_view()), route("websocket.disconnect", ChatSocketView.as_view()), ] not_found_routing = [ route("websocket.connect", "api.consumers.base.pass_message"), route("websocket.receive", "api.consumers.base.pass_message"), route("websocket.disconnect", "api.consumers.base.pass_message"), ] main_routing = [ # TODO поправить в настройках nginx include(composition_routing, path=r"^/ws/composition/(?P<composition_id>\d+)/$"), include(chat_routing, path=r"^/ws/chat/(?P<band_id>\d+)/$"), include(not_found_routing), ]
from channels import include project_routing = [ include("subs.app_routing.app_routing", path=r"^/core"), ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("dateSite.routing.websocket_routing", path=r"^/ws"), ]
from channels import include channel_routing = [ include("YamahaBookingApp.routing.twitter_channel_routing", path=r"^/YamahaBookingApp/twittermining"), #include("MotorMSRGeoTrackingApp.routing.PharmaFF_channel_routing", path=r"^/MotorMSRGeoTrackingApp/pharmaff_routing"), #include("MotorMSRGeoTrackingApp.routing.facebook_channel_routing", path=r"^/MotorMSRGeoTrackingApp/facebookmining"), ]
from channels import include channel_routing = [ include("isc_auth.routing.general_routing", path="^"), include("isc_auth.routing.custom_routing", path="^"), ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. #include("chat.routing.websocket_routing", path=r"^/chat/"), #include("chat.routing.sub_routing", path=r"^/chat/list_rooms/(?P<title>[a-zA-Z0-9_]+)/$"), #include("chat.routing.sub_routing", path=r"^/chat/list_rooms/"), # Custom handler for message sending (see Room.send_message). # Can't go in the include above as it's not got a `path` attribute to match on. include("chat.routing.custom_routing"), include("chat.routing.channel_routing" ), #, path=r"^/chat/list_rooms/(?P<title>[a-zA-Z0-9_]+)/$"), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. ]
from channels import include from channels.routing import route import weather.consumers as wc import location.consumers as lc import home.consumers as hc weather_routing = [ route("websocket.connect", wc.ws_add), route("websocket.receive", wc.ws_message), route("websocket.disconnect", wc.ws_disconnect), ] location_routing = [ route("websocket.connect", lc.ws_add), route("websocket.receive", lc.ws_message), route("websocket.disconnect", lc.ws_disconnect), ] home_routing = [ route("websocket.connect", hc.ws_add), route("websocket.receive", hc.ws_message), route("websocket.disconnect", hc.ws_disconnect), ] channel_routing = [ include(weather_routing, path=r"^/ws/weather"), include(location_routing, path=r"^/ws/location"), include(home_routing, path=r"^/ws/home"), ]
from channels.routing import route from channels import include from feeds.consumers import ws_connect, ws_receive, ws_disconnect chat_routing = [ route("websocket.connect", ws_connect), route("websocket.receive", ws_receive), route("websocket.disconnect", ws_disconnect) ] channel_routing = [include(chat_routing, path=r"^/chat")] """ manage.py runserver --noworker manage.py runworker // Note that the path doesn't matter right now; any WebSocket // connection gets bumped over to WebSocket consumers socket = new WebSocket("ws://" + window.location.host + "/chat/"); socket.onmessage = function(e) { alert(e.data); } socket.onopen = function() { socket.send("hello world"); } // Call onopen directly if socket is already open if (socket.readyState == WebSocket.OPEN) socket.onopen(); """
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("chat.routing.websocket_routing", path=r"^/chat/stream"), # Custom handler for message sending (see Room.send_message). # Can't go in the include above as it's not got a `path` attribute to match on. include("chat.routing.custom_routing"), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("chat.routing.websocket_routing", path=r"^/chat"), include("mess.routing.websocket_routing", path=r"^/mess"), include("library.routing.websocket_routing", path=r"^/library"), include("account.routing.websocket_routing", path=r"^/account"), ]
from channels import include channel_routing = [ include('blog.routing.channel_routing', path=r'^/blog/'), ]
from channels import include channel_routing = [ # Include subrouting from an app with predefined path matching. include("socialmedia.activities.routing.websocket_routing", path=r"^/notifications/$"), include("socialmedia.feeds.routing.websocket_routing", path=r"^/feeds/$"), include("socialmedia.messenger.routing.websocket_routing", path=r"^/") ]
from channels import route, include channel_routing = [ include("trivia.routing.websocket_routing"), include("trivia.routing.custom_routing"), ]
from channels import include from harberdasher.chat.routing import * # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include(websocket_routing, path=r"^/chat/stream"), # Custom handler for message sending (see Room.send_message). # Can't go in the include above as it's not got a `path` attribute to match on. include(custom_routing), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. # This makes Django serve static files from settings.STATIC_URL, similar # to django.views.static.serve. This isn't ideal (not exactly production # quality) but it works for a minimal example. include(http_routing), ]
from channels import include project_routing = [ include('dashboard.routing.app_routing', path=r'^/snippet-ws'), ]
# In routing.py from channels import route from channels import include channel_routing = [ include("chat.routing.websocket_routing"), include("chat.routing.custom_routing"), ]
from channels import include # The channel routing defines what channels get handled by what consumers, # including optional matching on message attributes. In this example, we match # on a path prefix, and then include routing from the chat module. channel_routing = [ # Include sub-routing from an app. include("chat.routing.websocket_routing", path=r"^/chat/stream"), # Custom handler for message sending (see Room.send_message). # Can't go in the include above as it's not got a 'path' attribute to match on. include("chat.routing.custom_routing"), # A default "http.request" route is always inserted by Django at the end of the routing list # that routes all unmatched HTTP requests to the Django view system. If you want lower-level # HTTP handling - e.g. long-polling - you can do it here and route by path, and let the rest # fall through to normal views. ]
from channels.routing import route from channels import include from chatdemo.consumers import chat_connect, chat_disconnect, chat_receive, loadhistory_connect, loadhistory_disconnect, loadhistory_receive chat_routing = [ route("websocket.connect", chat_connect), route("websocket.receive", chat_receive), route("websocket.disconnect", chat_disconnect) ] loadhistory_routing = [ route("websocket.connect", loadhistory_connect), route("websocket.receive", loadhistory_receive), route("websocket.disconnect", loadhistory_disconnect) ] channel_routing = [ include(chat_routing, path=r"^/ws/$"), include(loadhistory_routing, path=r"^/loadhistory/$"), ]