def __init__(self, udp_port, nick, prefix, chatroom, url = None, protocols = [], debug = False, debugCodePaths = False): ''' Args: udp_port (int) : The udp port to listen for WebRTC traffice. nick (str) : The nickname for the local user. prefix (str) : The prefix for the local user. chatroom (str) : The chatroom to join. Kwargs: url : The url for websocket server And other default kwargs of WebSocketServerFactory. A roster for the chatroom is maintained here. CcnxSocket created for PeetsMessages propagation if NDN. ''' # super can only work with new style classes which inherits from object # apparently WebSocketServerFactory is old style class WebSocketServerFactory.__init__(self, url = url, protocols = protocols, debug = debug, debugCodePaths = debugCodePaths) self.handlers = {'join_room' : self.handle_join, 'send_ice_candidate' : self.handle_ice_candidate, 'send_offer' : self.handle_offer, 'media_ready' : self.handle_media_ready, 'chat_msg': self.handle_chat} # keep the list of local clients, first, we deal with the case where there is only one local client self.client = None # keep the list of remote users self.roster = None self.listen_port = udp_port self.__class__.__logger.debug('UDP-PORT=%s', str(udp_port)) self.ccnx_socket = CcnxSocket() self.ccnx_socket.start() self.local_status_callback = lambda status: 0 self.nick = nick self.prefix = prefix self.chatroom = chatroom
def __init__(self, protocolCls, manager, url): """ Initialize the Factory. """ WebSocketServerFactory.__init__(self, url) self._protocolCls = protocolCls self._manager = manager
def __init__(self, url, debug = False, ident = None): if ident is not None: server = ident else: server = "AutobahnPython/%s" % autobahn.version WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debug, server = server) self.setProtocolOptions(failByDrop = False) # spec conformance
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = [] self.tickGap = 5 self.tickSetup() listenWS(self)
def __init__(self, spec, debug = False): WebSocketServerFactory.__init__(self, debug = debug, debugCodePaths = debug) FuzzingFactory.__init__(self, spec.get("outdir", "./reports/clients/")) # needed for wire log / stats self.logOctets = True self.logFrames = True ## WebSocket session parameters ## self.setSessionParameters(url = spec["url"], protocols = spec.get("protocols", []), server = "AutobahnTestSuite/%s-%s" % (autobahntestsuite.version, autobahn.version)) ## WebSocket protocol options ## self.setProtocolOptions(**spec.get("options", {})) self.spec = spec self.CaseSet = CaseSet(CaseBasename, Cases, CaseCategories, CaseSubCategories) self.specCases = self.CaseSet.parseSpecCases(self.spec) self.specExcludeAgentCases = self.CaseSet.parseExcludeAgentCases(self.spec) print "Autobahn WebSockets %s/%s Fuzzing Server (Port %d%s)" % (autobahntestsuite.version, autobahn.version, self.port, ' TLS' if self.isSecure else '') print "Ok, will run %d test cases for any clients connecting" % len(self.specCases) print "Cases = %s" % str(self.specCases)
def __init__(self, *args, **kwargs): # pop api parameter off self.api = kwargs.pop('api', None) self.allow_ga = kwargs.pop('allow_ga', None) self.deny_ga = kwargs.pop('deny_ga', None) kwargs['server'] = 'saged/0.1.0 (libcbus)' WebSocketServerFactory.__init__(self, *args, **kwargs) self.clients = [] # wire up events so we can handle events from cdbusd and populate to clients for n, m in ( ('on_lighting_group_on', self.on_lighting_group_on), ('on_lighting_group_off', self.on_lighting_group_off), ('on_lighting_group_ramp', self.on_lighting_group_ramp) ): api.connect_to_signal( handler_function=m, signal_name=n )
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = [] self.tickGap = 5 self.tickSetup() listenWS(self)
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = [] self.client_state = {} self.tick()
def __init__(self, url, debug=False, ident=None): if ident is not None: server = ident else: server = "AutobahnPython/%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-XXX compression extensions ## def accept(offers): for offer in offers: if isinstance(offer, PerMessageDeflateOffer): return PerMessageDeflateOfferAccept(offer) elif isinstance(offer, PerMessageBzip2Offer): return PerMessageBzip2OfferAccept(offer) elif isinstance(offer, PerMessageSnappyOffer): return PerMessageSnappyOfferAccept(offer) self.setProtocolOptions(perMessageCompressionAccept=accept)
def __init__(self, url, geoip_db, geoip_update_interval, lang, project, *a, **kw): WebSocketServerFactory.__init__(self, url, *a, **kw) self.clients = set() self.tickcount = 0 start_monitor(self, geoip_db, geoip_update_interval, lang, project) # blargh
def __init__(self, url, geoip_db, geoip_update_interval, lang, project, *a, **kw): WebSocketServerFactory.__init__(self, url, *a, **kw) self.clients = set() self.tickcount = 0 start_monitor(self, geoip_db, geoip_update_interval, lang, project) # blargh
def __init__(self, *args, **kwargs): self.username = kwargs.pop('username') self.password = kwargs.pop('password') self.proxy_host = kwargs.pop('proxy_host', None) self.proxy_port = kwargs.pop('proxy_port', 8080) self.clients = set() WebSocketServerFactory.__init__(self, *args, **kwargs) self.initialize()
def __init__(self, url, debug=False, debugCodePaths=False): WebSocketServerFactory.__init__(self, url, debug=debug, debugCodePaths=debugCodePaths) self.clients = [] self.tickcount = 0 start_monitor(self)
def __init__(self, url, debug=False, debugCodePaths=False): WebSocketServerFactory.__init__(self, url, debug=debug, debugCodePaths=debugCodePaths) self.clients = [] self.sensorReadings = deque([]) self.averageReading = 0 self.oldAverageReading = 0 self.tickcount = 0 self.tick()
def __init__(self, url, debug=False, debugCodePaths=False): WebSocketServerFactory.__init__(self, url, debug=debug, debugCodePaths=debugCodePaths) self.clients = [] self.tickcount = 0 self.tick()
def __init__(self, url, debug = False, debugCodePaths = False): WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debugCodePaths) self.clients = [] self.posdict = {} self.statedict = {} self.randvals = [] self.tickcount = 0 self.allready = True self.tick()
def __init__(self, url, monitor, config, dev_mode, debug = False, debugCodePaths = False): WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debugCodePaths) self.config = config self.dev_mode = dev_mode self.msg_queue = Queue.Queue(maxsize=200) self.producers = [] self.monitor = monitor print "in server: properly exiting server factory constructor... "
def __init__(self, url, debug=False, debugCodePaths=False): WebSocketServerFactory.__init__(self, url, debug=debug, debugCodePaths=debugCodePaths) self.clients = [] self.sensorReadings = deque([]) self.averageReading = 0 self.oldAverageReading = 0 self.tickcount = 0 self.tick()
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = [] self.tick() #TODO: Move this to threading model and start/stop the thread only when we have registered clients # Create a thread as follows try: thread.start_new_thread(update_ports, (self, )) except: print "Error: unable to start thread"
def __init__(self, host, server, debug): WebSocketServerFactory.__init__(self, host, server=server, debug=debug) #Used to get a dictionary of all clients currently connected. #Key - Username as a string #Value - Client protocol self.clients = {} #Used to get a dictionary of all channels currently created. #Key - Channel hash as a string #Value - Channel or Private Channel object self.channels = dict()
def __init__(self, *args, **kwargs): WebSocketServerFactory.__init__(self, *args, **kwargs) # safari self.allowHixie76 = True # identify rpi's by their macs # identify user by peerstr self.rpi_clients = {} self.user_client = {} # key RPI mac, value list of user clients self.rpi_clients_registered_users = {}
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = [] self.tickcount = 0 self.maxWidth = 700 self.maxHeight = 500 self.leftHandPosition = [0, 0] self.rightHandPosition= [0, 0] self.leftHandState = "O" self.rightHandState = "O" self.deltaScale = 5 self.broadcast("Let's start!")
def __init__(self, *args, **kwargs): WebSocketServerFactory.__init__(self, *args, **kwargs) # safari self.allowHixie76 = True # identify rpi's by their macs # identify user by peerstr self.rpi_clients = {} self.user_client = {} # key RPI mac, value list of user clients self.rpi_clients_registered_users = {}
def __init__(self, *args, **kwargs): self.database = kwargs.pop('database') self.config = kwargs.pop('config') WebSocketServerFactory.__init__(self, *args, **kwargs) self.logger = logging.getLogger(__name__) self.connections = {} self.stations = {} task.LoopingCall(self.fetch_playlist).start(300, now=False) task.LoopingCall(self.send_status).start(30)
def __init__(self, url, debug = False, debugCodePaths = False): WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debugCodePaths) self.qlength = 0 self.num_msg = 0 self.throughput = 0.0 self.latency = 0.0 self.num_clients = 0 self.old_timestamp = datetime.datetime.utcnow() self.old_num_msg = 0 self.clients = []
def __init__(self, url, dbpool, services, reactor = None): WebSocketServerFactory.__init__(self, url, debug = False, debugCodePaths = False, reactor = reactor) self.dbpool = dbpool self.services = services ## reset Echo endpoint stats ## self.stats = {'wsecho-connections': 0, 'wsecho-echos-text-count': 0, 'wsecho-echos-text-bytes': 0, 'wsecho-echos-binary-count': 0, 'wsecho-echos-binary-bytes': 0} self.statsChanged = False
def __init__(self, *args, **kwargs): WebSocketServerFactory.__init__(self, *args, **kwargs) # safari self.allowHixie76 = True # Identify MSP430's by their macs # Identify user by peerstr self.msp430_clients = {} self.user_client = {} # Key MSP430 mac, value list of user clients self.msp430_clients_registered_users = {}
def __init__(self, url, debug=False, serializers=None, reactor=None): if serializers is None: serializers = [WampMsgPackSerializer(), WampJsonSerializer()] self._serializers = {} for ser in serializers: self._serializers[ser.SERIALIZER_ID] = ser protocols = ["wamp.2.%s" % ser.SERIALIZER_ID for ser in serializers] WebSocketServerFactory.__init__(self, url, debug=debug, protocols=protocols, reactor=reactor)
def __init__(self, port, is_secure=False, debug=False, signing_key=None, signing_id=None, event_handler=GenericEventHandler): self.debug = debug self.signing_key = signing_key self.signing_id = signing_id self.protocol = WebsocketServerProtocol self.event_handler = event_handler if is_secure: uri = "wss://0.0.0.0:%d" % port else: uri = "ws://0.0.0.0:%d" % port WebSocketServerFactory.__init__(self, uri) # P.S. There's not Websocket client implementation yet # P.P.S. And it probably won't be for long time...'
def __init__(self, *args, **kwargs): # pop api parameter off self.api = kwargs.pop('api', None) self.allow_ga = kwargs.pop('allow_ga', None) self.deny_ga = kwargs.pop('deny_ga', None) kwargs['server'] = 'saged/0.1.0 (libcbus)' WebSocketServerFactory.__init__(self, *args, **kwargs) self.clients = [] # wire up events so we can handle events from cdbusd and populate to clients for n, m in (('on_lighting_group_on', self.on_lighting_group_on), ('on_lighting_group_off', self.on_lighting_group_off), ('on_lighting_group_ramp', self.on_lighting_group_ramp)): api.connect_to_signal(handler_function=m, signal_name=n)
def __init__(self, realm, url, **kw): """ Initialize the Factory. @param realm: Robot realm implementing necessary callback methods for the protocol. @type realm: rce.comm.interfaces.IRobotRealm @param url: URL where the WebSocket server factory will listen for connections. For more information refer to the base class: autobahn.websocket.WebSocketServerFactory @type url: str @param kw: Additional keyworded arguments will be passed to the __init__ of the base class. """ WebSocketServerFactory.__init__(self, url, **kw) self._realm = realm
def __init__(self, realm, url, **kw): """ Initialize the Factory. @param realm: Robot realm implementing necessary callback methods for the protocol. @type realm: rce.comm.interfaces.IRobotRealm @param url: URL where the websocket server factory will listen for connections. For more information refer to the base class: autobahn.websocket.WebSocketServerFactory @type url: str @param kw: Additional keyworded arguments will be passed to the __init__ of the base class. """ WebSocketServerFactory.__init__(self, url, **kw) self._realm = realm
def __init__(self, port, is_secure=False, debug=False, signing_key=None, signing_id=None, event_handler=GenericEventHandler): self.debug = debug self.signing_key = signing_key self.signing_id = signing_id self.protocol = WebsocketServerProtocol self.event_handler = event_handler if is_secure: uri = "wss://0.0.0.0:%d" % port else: uri = "ws://0.0.0.0:%d" % port WebSocketServerFactory.__init__(self, uri)
def __init__(self, url, debug = False, serializers = None, reactor = None): if serializers is None: serializers = [WampMsgPackSerializer(), WampJsonSerializer()] self._serializers = {} for ser in serializers: self._serializers[ser.SERIALIZER_ID] = ser protocols = ["wamp.2.%s" % ser.SERIALIZER_ID for ser in serializers] WebSocketServerFactory.__init__(self, url, debug = debug, protocols = protocols, reactor = reactor)
def __init__(self, url, dbpool, services, reactor=None): WebSocketServerFactory.__init__(self, url, debug=False, debugCodePaths=False, reactor=reactor) self.dbpool = dbpool self.services = services ## reset Echo endpoint stats ## self.stats = { 'wsecho-connections': 0, 'wsecho-echos-text-count': 0, 'wsecho-echos-text-bytes': 0, 'wsecho-echos-binary-count': 0, 'wsecho-echos-binary-bytes': 0 } self.statsChanged = False
def __init__(self, realm, url, **kw): """ Initialize the Factory. @param portal: Portal which is responsible for the authentication of the websocket connection and which will provide an Avatar for the robot in the cloud engine. @type portal: twisted.cred.portal.Portal @param url: URL where the websocket server factory will listen for connections. For more information refer to the base class: autobahn.websocket.WebSocketServerFactory @type url: str @param kw: Additional keyworded arguments will be passed to the __init__ of the base class. """ WebSocketServerFactory.__init__(self, url, **kw) self._realm = realm
def __init__(self, url, debug = False, ident = None): if ident is not None: server = ident else: server = "AutobahnPython/%s" % autobahn.version WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debug, server = server) self.setProtocolOptions(failByDrop = False) # spec conformance ## enable permessage-XXX compression extensions ## def accept(offers): for offer in offers: if isinstance(offer, PerMessageDeflateOffer): return PerMessageDeflateOfferAccept(offer) elif isinstance(offer, PerMessageBzip2Offer): return PerMessageBzip2OfferAccept(offer) elif isinstance(offer, PerMessageSnappyOffer): return PerMessageSnappyOfferAccept(offer) self.setProtocolOptions(perMessageCompressionAccept = accept)
def __init__(self, port, is_secure=False, debug=False, signing_key=None, signing_id=None, event_handler=GenericEventHandler): self.debug = debug self.signing_key = signing_key self.signing_id = signing_id self.protocol = WebsocketServerProtocol self.event_handler = event_handler if is_secure: uri = "wss://0.0.0.0:%d" % port else: uri = "ws://0.0.0.0:%d" % port WebSocketServerFactory.__init__(self, uri) # P.S. There's not Websocket client implementation yet # P.P.S. And it probably won't be for long time...'
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = [] self.tickcount = 0 self.tick()
def __init__(self, url, debug = False, debugCodePaths = False): WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debugCodePaths) self.clients = []
def __init__(self, **kwargs): WebSocketServerFactory.__init__(self, **kwargs) self.clients = []
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = []
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = []
def __init__(self, url, debug=False, debugCodepaths=False): WebSocketServerFactory.__init__(self, url)
def __init__(self, uri, debug): WebSocketServerFactory.__init__(self, uri, debug=debug) self.pingsSent = {} self.pongsReceived = {}
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.CONNECTIONS = [] self.CLIENTS = {} self.PAINTBUFFER = []
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.keys_listener = DBusMediaKeyListener( callback=self._onMediaKeyEvent) self._clients = []
def __init__(self, *args, **kwargs): WebSocketServerFactory.__init__(self, *args, **kwargs) #super(WebSocketProcessOutputterThingFactory, self).__init__(self, *args, **kwargs) self.clients = [] self.process = ProcessProtocol(self) reactor.spawnProcess(self.process,COMMAND_NAME, COMMAND_ARGS, {}, usePTY=True)
def __init__(self, url): WebSocketServerFactory.__init__(self, url) self.clients = [] self.watchers = {} self.clients_watchers = [] self.tickcount = 0
def __init__(self, wsuri, debug=False): WebSocketServerFactory.__init__(self, wsuri, debug=debug, debugCodePaths=debug) self.stats = Stats()
def __init__(self, url, debug = False): WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debug)