Ejemplo n.º 1
0
    def __init__(self, listenUrl):
        WebSocketServerFactory.__init__(self, listenUrl)

        # List of connected websocket clients
        self.clients = []
        # List of received smartplug data
        self.smartplugs = {}
Ejemplo n.º 2
0
    def __init__(self):
        WebSocketServerFactory.__init__(self)
        logging.debug("Using WebSocket module " + str(self.server))

        self.openHandshakeTimeout   = 20
        self.closeHandshakeTimeout  =  5

        self.clients    = []    # for broadcast
    def __init__(self, config, *args, **kwargs):
        WebSocketServerFactory.__init__(self, *args, **kwargs)
        for module_name, module_data in config["modules"].items():
            module_import_name = re.sub('(?!^)([A-Z]+)', r'_\1', module_data["type"]).lower()
            self.modules[module_name] = module_data

            module_module = importlib.import_module("modules."+module_import_name)
            module_object = getattr(module_module, module_data["type"])
            self.modules[module_name]["module_object"] = module_object(**module_data)
Ejemplo n.º 4
0
    def __init__(self):
        WebSocketServerFactory.__init__(self)
        logging.debug("Using WebSocket module " + str(self.server))
        from mdbapi.server import cfg

        self.openHandshakeTimeout = cfg.websocket.opentimeout
        self.closeHandshakeTimeout = cfg.websocket.closetimeout

        self.clients = []  # for broadcast
Ejemplo n.º 5
0
 def __init__(self, url, config="config.json", *args, **kwargs):
     WebSocketServerFactory.__init__(self, url, *args, **kwargs)
     self.clients = []
     with open(config) as configfile:
         self.config.update(json.load(configfile))
     self.config['switchModule'] = importlib.import_module(self.config['switchModule'])
     for name in self.config["switches"]:
         switch_config = self.config['switches'][name]
         switch_class = switch_config['class']
         initial_data = switch_config
         switch = getattr(self.config["switchModule"], switch_class)(initial_data=initial_data, name=name, factory=self)
         self.config['switches'][name]['class'] = switch
Ejemplo n.º 6
0
    def __init__(self, config_file):

        # init before get called
        self.contexts = {}
        self.context_subscriptions = {}

        Application.__init__(self, config_file)
        WebSocketServerFactory.__init__(self)

        #greenlet.greenlet.__init__(self)

        # start the separate tasker process
        IN.tasker.start_the_process()
Ejemplo n.º 7
0
	def __init__(self, socketAddress, socketPort):
		WebSocketServerFactory.__init__(self, u"ws://%s:%d" % (socketAddress, socketPort), False)
		self.protocol = ProtocolHandler
		# Lets keep track of the address and port for use later.
		self.socketAddress = socketAddress
		self.socketPort = socketPort
		# Some stuff for the protocol...
		self.activeConnections = []
		self.generatedSnakes = []
		self.maxSnakeId = 100
		self.timestamp = 0
		self.snakeTravelSpeed = 10
		self.generatedFood = []
Ejemplo n.º 8
0
    def __init__(self):
        WebSocketServerFactory.__init__(self)

        self.state = {
            "current_song": None,
            "queue": [],
            "playing": True,
            "magic_mode": True,
            "duration_limit": None,
            "history": []
        }

        self.clients = []
Ejemplo n.º 9
0
	def __init__(self, config_file):
		
		# init before get called
		self.contexts = {}
		self.context_subscriptions = {}
		
		Application.__init__(self, config_file)
		WebSocketServerFactory.__init__(self)
		
		#greenlet.greenlet.__init__(self)
		
		# start the separate tasker process
		IN.tasker.start_the_process()
Ejemplo n.º 10
0
    def __init__(self):
        WebSocketServerFactory.__init__(self)
        logging.debug("Using WebSocket module " + str(self.server))
        from mdbapi.server import cfg

        self.openHandshakeTimeout = cfg.websocket.opentimeout
        self.closeHandshakeTimeout = cfg.websocket.closetimeout
        #logging.debug("openHandshakeTimeout = " + str(self.openHandshakeTimeout))
        #logging.debug("closeHandshakeTimeout= " + str(self.closeHandshakeTimeout))
        #logging.debug("autoPingTimeout      = " + str(self.autoPingTimeout))
        #logging.debug("autoPingInterval     = " + str(self.autoPingInterval))
        #logging.debug("server               = " + str(self.server))
        #logging.debug("isSecure             = " + str(self.isSecure))

        self.clients = []  # for broadcast
Ejemplo n.º 11
0
    def __init__(self, url, debug=False, ident=None):
        if ident is not None:
            server = ident
        else:
            server = "AutobahnPython-Asyncio/%s" % autobahn.version
        WebSocketServerFactory.__init__(self, url, debug=debug, debugCodePaths=debug, server=server)
        self.setProtocolOptions(failByDrop=False)  # spec conformance
        self.setProtocolOptions(failByDrop=True)  # needed for streaming mode
        # self.setProtocolOptions(utf8validateIncoming = False)

        # enable permessage-deflate
        ##
        def accept(offers):
            for offer in offers:
                if isinstance(offer, PerMessageDeflateOffer):
                    return PerMessageDeflateOfferAccept(offer)

        self.setProtocolOptions(perMessageCompressionAccept=accept)
    def __init__(self, url):
        testee_ident = autobahn.asyncio.__ident__
        self.log.info("Testee identification: {testee_ident}", testee_ident=testee_ident)
        WebSocketServerFactory.__init__(self, url, server=testee_ident)

        self.setProtocolOptions(failByDrop=False)  # spec conformance
        # self.setProtocolOptions(utf8validateIncoming = False)

        if USE_STREAMING_TESTEE:
            self.setProtocolOptions(failByDrop=True)  # needed for streaming mode
        else:
            # enable permessage-deflate WebSocket protocol extension
            def accept(offers):
                for offer in offers:
                    if isinstance(offer, PerMessageDeflateOffer):
                        return PerMessageDeflateOfferAccept(offer)

            self.setProtocolOptions(perMessageCompressionAccept=accept)
Ejemplo n.º 13
0
    def __init__(self, url, debug=False, ident=None):
        if ident is not None:
            server = ident
        else:
            server = "AutobahnPython-Asyncio/%s" % autobahn.version
        WebSocketServerFactory.__init__(self, url, debug=debug, debugCodePaths=debug, server=server)
        self.setProtocolOptions(failByDrop=False)  # spec conformance
        self.setProtocolOptions(failByDrop=True)  # needed for streaming mode
        # self.setProtocolOptions(utf8validateIncoming = False)

        # enable permessage-deflate
        ##
        def accept(offers):
            for offer in offers:
                if isinstance(offer, PerMessageDeflateOffer):
                    return PerMessageDeflateOfferAccept(offer)

        self.setProtocolOptions(perMessageCompressionAccept=accept)
Ejemplo n.º 14
0
    def __init__(self, url):
        testee_ident = autobahn.asyncio.__ident__
        self.log.info("Testee identification: {testee_ident}",
                      testee_ident=testee_ident)
        WebSocketServerFactory.__init__(self, url, server=testee_ident)

        self.setProtocolOptions(failByDrop=False)  # spec conformance
        # self.setProtocolOptions(utf8validateIncoming = False)

        if USE_STREAMING_TESTEE:
            self.setProtocolOptions(
                failByDrop=True)  # needed for streaming mode
        else:
            # enable permessage-deflate WebSocket protocol extension
            def accept(offers):
                for offer in offers:
                    if isinstance(offer, PerMessageDeflateOffer):
                        return PerMessageDeflateOfferAccept(offer)

            self.setProtocolOptions(perMessageCompressionAccept=accept)
Ejemplo n.º 15
0
    def __init__(self, url, zmq_endpoint, server_type, debug=False, debugCodePaths=False):
        WebSocketServerFactory.__init__(self, url, debug=debug, debugCodePaths=debugCodePaths)
        self.tickcount = 0

        self.server_type = server_type

        self.cleanClientsTimeout = 1
        self.clientMaxTimeout = 30
        self.statsTimeout = 1

        self.clients = {}

        self.context = zmq.Context()
        self.recv_context = self.context.socket(zmq.PULL)
        self.recv_context.bind(zmq_endpoint)

        self.cycleTracker = [0]

        self.timeouts = [0]
        self.packetLoss = [0]

        self.messagesCount = 0
Ejemplo n.º 16
0
 def __init__(self, *args):
     WebSocketServerFactory.__init__(self, *args)
     self.clients = []
Ejemplo n.º 17
0
 def __init__(self, url, host, port, graph):
     print "INIT FACTORY"
     WebSocketServerFactory.__init__(self, url, host, port, graph)
     self.sib_host = host
     self.sib_port = port
     self.graph = graph
Ejemplo n.º 18
0
 def __init__(self, url):
     WebSocketServerFactory.__init__(self, url)
     self.clients = []
     self.tickcount = 0
     self.tick()
Ejemplo n.º 19
0
 def __init__(self, daq, **kwargs):
     WebSocketServerFactory.__init__(self, **kwargs)
     self.daq = daq
     self.clients = list()
Ejemplo n.º 20
0
 def __init__(self, *args, **kwargs):
     WebSocketServerFactory.__init__(self, *args, **kwargs)
     self.clients = []
     self.subscriptions = {}
Ejemplo n.º 21
0
 def __init__(self, url, image_dir, session_age, restored_messages):
     WebSocketServerFactory.__init__(self, url)
     self._cookies = {}
     self.image_dir = image_dir
     self.session_max_age = session_age
     self.restored_messages = restored_messages
Ejemplo n.º 22
0
 def __init__(self, url, callbacks, debug=False, debugCodePaths=False):
     WebSocketServerFactory.__init__(self, url, debug=debug, debugCodePaths=debugCodePaths)
     self.__callbacks = callbacks
     self.__clients = []
Ejemplo n.º 23
0
 def __init__(self):
     WebSocketServerFactory.__init__(self, "ws://127.0.0.1:9000")
     self.clients = set()
     self.virtual_device = ServerVirtualDevice()
     self.device = self.virtual_device.get_device()
Ejemplo n.º 24
0
 def __init__(self, url):
     WebSocketServerFactory.__init__(self, url)
     self.clients = []
Ejemplo n.º 25
0
 def __init__(self, url, debug = False, debugCodePaths = False):
     WebSocketServerFactory.__init__(self, url, debug, debugCodePaths)
     self.clients = []
Ejemplo n.º 26
0
 def __init__(self, url, debug=False, debugCodePaths=False):
     WebSocketServerFactory.__init__(self,
                                     url,
                                     debug=debug,
                                     debugCodePaths=debugCodePaths)
Ejemplo n.º 27
0
    def __init__(self, verbose=False):
        WebSocketServerFactory.__init__(self)

        self.verbose = verbose
        self.clients = []
Ejemplo n.º 28
0
 def __init__(self, url):
     WebSocketServerFactory.__init__(self, url)
Ejemplo n.º 29
0
 def __init__(self, url):
     WebSocketServerFactory.__init__(self, url)
     self.clients = []
     self.tickcount = 0
     self.tick()