Esempio n. 1
0
def telegraphy_ws_url(context):
    """Returns the gateway web socket URL"""
    host = settings.TELEGRAPHY_WS_HOST

    request = context.get('request')
    if not request:
        raise ImproperlyConfigured("Request is not present in context")
    # TODO: Check if this comparision is valid and/or sane
    host = extract_host_from_request(request)
    if settings.TELEGRAPHY_WS_HOST is not None:
        if settings.TELEGRAPHY_WS_HOST != host:
            raise ImproperlyConfigured(
                "TELEGRAPHY_WS_HOST and current host do not match!")
    return build_url_from_settings(settings)
Esempio n. 2
0
 def url(self):
     if not self._url:
         self._url = build_url_from_settings(self.settings)
     return self._url