示例#1
0
    def start(self):
        ws_url = "ws" + server.url[4:] + "/webrtcgateway/ws"
        self.factory = SylkWebSocketServerFactory(
            ws_url, protocols=[SYLK_WS_PROTOCOL], server="SylkServer/%s" % sylk_version, debug=False
        )
        self.factory.setProtocolOptions(
            allowedOrigins=GeneralConfig.web_origins,
            autoPingInterval=GeneralConfig.websocket_ping_interval,
            autoPingTimeout=GeneralConfig.websocket_ping_interval / 2,
        )
        self.factory.ws_logger = self.ws_logger

        self.web = WebRTCGatewayWeb(self.factory)
        server.register_resource("webrtcgateway", self.web.resource())

        log.msg("WebSocket handler started at %s" % ws_url)
        log.msg("Allowed web origins: %s" % ", ".join(GeneralConfig.web_origins))
        log.msg("Allowed SIP domains: %s" % ", ".join(GeneralConfig.sip_domains))
        log.msg("Using Janus API: %s" % JanusConfig.api_url)

        self.ws_logger.start()

        self.backend = JanusBackend()
        self.backend.start()

        self.factory.backend = self.backend
示例#2
0
class WebHandler(object):
    def __init__(self):
        self.backend = None
        self.factory = None
        self.resource = None
        self.web = None
        self.ws_logger = WSLogger()

    def start(self):
        ws_url = 'ws' + server.url[4:] + '/webrtcgateway/ws'
        self.factory = SylkWebSocketServerFactory(ws_url, protocols=[SYLK_WS_PROTOCOL], server='SylkServer/%s' % sylk_version, debug=False)
        self.factory.setProtocolOptions(allowedOrigins=GeneralConfig.web_origins,
                                        autoPingInterval=GeneralConfig.websocket_ping_interval,
                                        autoPingTimeout=GeneralConfig.websocket_ping_interval/2)
        self.factory.ws_logger = self.ws_logger

        self.web = WebRTCGatewayWeb(self.factory)
        server.register_resource('webrtcgateway', self.web.resource())

        log.msg('WebSocket handler started at %s' % ws_url)
        log.msg('Allowed web origins: %s' % ', '.join(GeneralConfig.web_origins))
        log.msg('Allowed SIP domains: %s' % ', '.join(GeneralConfig.sip_domains))
        log.msg('Using Janus API: %s' % JanusConfig.api_url)

        self.ws_logger.start()

        self.backend = JanusBackend()
        self.backend.start()

        self.factory.backend = self.backend

    def stop(self):
        if self.factory is not None:
            for conn in self.factory.connections.copy():
                conn.failConnection()
            self.factory = None
        if self.backend is not None:
            self.backend.stop()
            self.backend = None
        self.ws_logger.stop()
示例#3
0
class WebHandler(object):
    def __init__(self):
        self.backend = None
        self.factory = None
        self.resource = None
        self.web = None
        self.ws_logger = WSLogger()

    def start(self):
        ws_url = 'ws' + server.url[4:] + '/webrtcgateway/ws'
        self.factory = SylkWebSocketServerFactory(ws_url, protocols=[SYLK_WS_PROTOCOL], server='SylkServer/%s' % sylk_version)
        self.factory.setProtocolOptions(allowedOrigins=GeneralConfig.web_origins,
                                        autoPingInterval=GeneralConfig.websocket_ping_interval,
                                        autoPingTimeout=GeneralConfig.websocket_ping_interval/2)
        self.factory.ws_logger = self.ws_logger

        self.web = WebRTCGatewayWeb(self.factory)
        server.register_resource('webrtcgateway', self.web.resource())

        log.msg('WebSocket handler started at %s' % ws_url)
        log.msg('Allowed web origins: %s' % ', '.join(GeneralConfig.web_origins))
        log.msg('Allowed SIP domains: %s' % ', '.join(GeneralConfig.sip_domains))
        log.msg('Using Janus API: %s' % JanusConfig.api_url)

        self.ws_logger.start()

        self.backend = JanusBackend()
        self.backend.start()

        self.factory.backend = self.backend

    def stop(self):
        if self.factory is not None:
            for conn in self.factory.connections.copy():
                conn.dropConnection(abort=True)
            self.factory = None
        if self.backend is not None:
            self.backend.stop()
            self.backend = None
        self.ws_logger.stop()
示例#4
0
    def start(self):
        ws_url = 'ws' + server.url[4:] + '/webrtcgateway/ws'
        self.factory = SylkWebSocketServerFactory(ws_url, protocols=[SYLK_WS_PROTOCOL], server='SylkServer/%s' % sylk_version, debug=False)
        self.factory.setProtocolOptions(allowedOrigins=GeneralConfig.web_origins)
        self.factory.ws_logger = self.ws_logger

        self.web = WebRTCGatewayWeb(self.factory)
        server.register_resource('webrtcgateway', self.web.resource())

        log.msg('WebSocket handler started at %s' % ws_url)
        log.msg('Allowed web origins: %s' % ', '.join(GeneralConfig.web_origins))
        log.msg('Allowed SIP domains: %s' % ', '.join(GeneralConfig.sip_domains))
        log.msg('Using Janus API: %s' % JanusConfig.api_url)

        self.ws_logger.start()

        self.backend = JanusBackend()
        self.backend.start()

        self.factory.backend = self.backend