Python channels.routing.URLRouter() Examples
The following are 2
code examples of channels.routing.URLRouter().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
channels.routing
, or try the search function
.
Example #1
Source File: discovery.py From omniport-backend with GNU General Public License v3.0 | 6 votes |
def _prepare_ws_urlpatterns(app_set): """ Generate WS URL patterns for the given list of tuples of apps and configuration objects :param app_set: the given list of tuples of apps and their configuration objects :return: the WS URL patterns """ ws_urlpatterns = list() for (app, app_configuration) in app_set: if app_configuration.is_allowed: url = app_configuration.base_urls.ws if url is not None: module = importlib.import_module(f'{app}.ws_urls') dictionary = module.__dict__ app_urlpatterns = dictionary['urlpatterns'] url_router = URLRouter(app_urlpatterns) ws_urlpatterns.append( path(url, url_router) ) return ws_urlpatterns
Example #2
Source File: router.py From django-pgschemas with MIT License | 5 votes |
def get_protocol_type_router(self, tenant_prefix, ws_urlconf): """ Subclasses can override this to include more protocols. """ return TenantAwareProtocolTypeRouter( {"websocket": TenantAuthMiddlewareStack(URLRouter(ws_urlconf))}, tenant_prefix )