当前位置: 首页>>代码示例>>Python>>正文


Python wamp.WampClientFactory类代码示例

本文整理汇总了Python中autobahn.wamp.WampClientFactory的典型用法代码示例。如果您正苦于以下问题:Python WampClientFactory类的具体用法?Python WampClientFactory怎么用?Python WampClientFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WampClientFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, test, peerIndex, onReady, onGone):
    WampClientFactory.__init__(self, test.testee.url)
    self.test = test
    self.peerIndex = peerIndex
    self.onReady = onReady
    self.onGone = onGone
    self.proto = None
开发者ID:crossbario,项目名称:autobahn-testsuite,代码行数:7,代码来源:wampcase2_2_x_x.py

示例2: _connectClient

 def _connectClient(self, connected, opened, clientDisconnected):
     factory = WampClientFactory('ws://localhost:9000', debugWamp=True)
     factory.protocol = ClientProtocol
     factory.onConnectionMade = connected
     factory.onSessionOpen = opened
     factory.onConnectionLost = clientDisconnected
     self.factory = factory
     return connectWS(factory)
开发者ID:jsdir,项目名称:stretch,代码行数:8,代码来源:test_agent.py

示例3: __init__

 def __init__(self, peerIndex, onReady, onGone, test, result):
    assert(self.protocol)
    WampClientFactory.__init__(self, test.testee.url)
    self.peerIndex = peerIndex
    self.onReady = onReady
    self.onGone = onGone
    self.test = test
    self.result = result
    self.proto = None
开发者ID:yuanjuxing,项目名称:AutobahnTestSuite,代码行数:9,代码来源:wampcase.py

示例4: __init__

 def __init__(self, options, debug):
    self.options = options
    self.user = "admin"
    self.password = options["password"]
    self.command = options["command"]
    if self.command == 'connect':
       self.reconnect = True
    else:
       self.reconnect = False
    if options["spec"]:
       self.config = json.loads(open(options["spec"]).read())
    else:
       self.config = None
    WampClientFactory.__init__(self, options["wsuri"], debugWamp = debug)
开发者ID:jamjr,项目名称:crossbar,代码行数:14,代码来源:cli.py

示例5: __init__

 def __init__( self, host, auth=None ):
     DEBUG = False
     f = WampClientFactory( "ws://%s:2001" % host, 
                            debugWamp = DEBUG)
     f.protocol = WorkflowClientProtocol
     f.rpcAuth = auth
     f.cnx = self
     self.session = None
     self.__factory = f
     self.nextRequestId = 1
     self.__pending = { 0: [None,threading.Event()] }
     self.__thread = threading.Thread( target=self.__run )
     self.__thread.daemon = True
     self.__thread.start()
开发者ID:dkolbly,项目名称:flowman,代码行数:14,代码来源:rpc.py

示例6: __init__

   def __init__(self, config):

      WampClientFactory.__init__(self, config.wsuri, debugWamp = config.debug)

      self.config = config
      self.receivedCnt = 0
      self.receivedRtts = []

      self.setProtocolOptions(failByDrop = False)

      if config.skiputf8validate:
         self.setProtocolOptions(utf8validateIncoming = False)

      if config.skipmasking:
         self.setProtocolOptions(maskClientFrames = False)
开发者ID:boonedox,项目名称:AutobahnPython,代码行数:15,代码来源:client.py

示例7: publisher

def publisher(c_name="all", debug=True):
    log.startLogging(sys.stdout)
    if c_name != "all":
        channel_name = "notifications:%s" % c_name
    else:
        channel_name = "notifications:all"
    #print "user name in Publisher: ", channel_name

    PUBSUB.subscribe(channel_name)

    '''
    factory = WampClientFactory("ws://%s:9000" % socket.gethostname(),
                                debugWamp=debug)
    '''

    factory = WampClientFactory("ws://localhost:9000", debugWamp=debug)
    factory.protocol = PubSubClient1
    connectWS(factory)

    reactor.run()
开发者ID:am1ty9d9v,项目名称:oposod,代码行数:20,代码来源:tasks.py

示例8: __init__

 def __init__(self, options, reactor):
    self.options = options
    self.done = False
    WampClientFactory.__init__(self,
                               self.options.server,
                               debugWamp = self.options.debug)
开发者ID:Inspire2Innovate,项目名称:crossbar,代码行数:6,代码来源:cli.py

示例9: onMessage

      print "connected to Gephi"

   def onMessage(self, msg, binary):
      if not binary:
         obj = json.loads(msg)
         self.factory.forwarder.publish(GEPHI_TOPIC_URI + "1", obj)


class GephiForwardingProtocol(WampClientProtocol):

   def onSessionOpen(self):
      print "connected to WAMP server"
      factory = WebSocketClientFactory(GEPHI_SERVER_URL)
      factory.protocol = GephiClientProtocol
      factory.forwarder = self
      connectWS(factory)



if __name__ == '__main__':

   log.startLogging(sys.stdout)
   debug = len(sys.argv) > 1 and sys.argv[1] == 'debug'

   factory = WampClientFactory(WAMP_SERVER_URL, debugWamp = debug)
   factory.protocol = GephiForwardingProtocol

   connectWS(factory)

   reactor.run()
开发者ID:luodaobin,项目名称:scratchbox,代码行数:30,代码来源:gephiwampforwarder.py

示例10: dataReceived

    def dataReceived(self, data):
        self.resetTimeout()
        print len(data)
        if len(data) == 11:
            packet = Packet(data)
            print packet
            self._publish(packet.toDict())
            reactor.callLater(0.1, self.sendCMD, 'GET')
        else:
           log.msg("Received Gargabe")
           log.msg("LEN: %s " % len(data))
           log.msg(data)

    def lineReceived(self, line):
        log.msg("Line Received")
        log.msg(line)


if __name__ == '__main__':
    ##Setup Server
    wampServerFactory = WampServerFactory("ws://localhost:9000")
    wampServerFactory.protocol = TSPublisher
    listenWS(wampServerFactory)

    ##Setup Client
    wampClientFactory = WampClientFactory("ws://localhost:9000")
    wampClientFactory.protocol = TSClient
    connectWS(wampClientFactory)

    reactor.run()
开发者ID:klemmster,项目名称:tsd-live,代码行数:30,代码来源:readTSD.py

示例11: __init__

 def __init__(self, case, onReady, onGone, subscribeTopics):
     WampClientFactory.__init__(self, case.url, debug=case.debugWs, debugWamp=case.debugWamp)
     self.case = case
     self.onReady = onReady
     self.onGone = onGone
     self.subscribeTopics = subscribeTopics
开发者ID:normanmaurer,项目名称:autobahntestsuite-maven-plugin,代码行数:6,代码来源:wampcase1.py

示例12: KeyValueClientProtocol


class KeyValueClientProtocol(WampClientProtocol):

   def done(self, *args):
      self.sendClose()
      reactor.stop()

   def show(self, key, value):
      print key, value

   def get(self, keys):
      defs = []
      for key in keys:
         d = self.call("keyvalue:get", key).addCallback(lambda value, key = key: self.show(key, value))
         defs.append(d)
      return DeferredList(defs)

   def onSessionOpen(self):
      self.prefix("keyvalue", "http://example.com/simple/keyvalue#")
      self.call("keyvalue:keys").addCallbacks(self.get).addCallback(self.done)


if __name__ == '__main__':

   log.startLogging(sys.stdout)
   factory = WampClientFactory("ws://localhost:8080/ws")
   factory.protocol = KeyValueClientProtocol
   connectWS(factory)
   reactor.run()
开发者ID:Aerobota,项目名称:autobahn_rce,代码行数:28,代码来源:client.py

示例13: __init__

 def __init__(self, url, debug = False, debugCodePaths = False, debugWamp = False, debugApp = False):
     WampClientFactory.__init__(self, url, debug = debug, debugCodePaths = debugCodePaths)
     self.spiders = {}
     self.is_first = 0
开发者ID:mobishift2011,项目名称:data007,代码行数:4,代码来源:spider_runner.py

示例14: logerror

   def logerror(self, e):
      erroruri, errodesc, errordetails = e.value.args
      print "ERROR: %s ('%s') - %s" % (erroruri, errodesc, errordetails)

   def done(self, *args):
      self.sendClose()
      reactor.stop()

   def onSessionOpen(self):

      # Set the App Prefix
      self.prefix("moirai", "http://%s/%s/" % (app_domain, app_name))
      
      query = "START n=node(*) RETURN n;"

      params = {}
      self.call("moirai:cypher", query, params).addCallbacks(self.nodesFirst)



############## STUFF HAPPENS HERE  #############

if __name__ == '__main__':

   log.startLogging(sys.stdout)
   factory = WampClientFactory("ws://%s:%s" % (ws_host, ws_port), debugWamp = True)
   factory.protocol = SimpleClientProtocol
   connectWS(factory)
   reactor.run()
开发者ID:gdbassett,项目名称:moirai,代码行数:29,代码来源:abrpctestclient.py

示例15: onPong

   def onPong(self, payload):
      id = payload[:16]
      l = len(payload) - 16
      now = datetime.datetime.utcnow()

      if self.beats.has_key(id):
         rtt_ms = (now - self.beats[id]).total_seconds() * 1000.
         print "Got heartbeat: " + id, l, rtt_ms



if __name__ == '__main__':

   if len(sys.argv) < 2:
      print "Need the WebSocket server address, i.e. ws://localhost:9000"
      sys.exit(1)

   log.startLogging(sys.stdout)

   debug = False

   #factory = WebSocketClientFactory(sys.argv[1], debug = True, debugCodePaths = True)
   factory = WampClientFactory(sys.argv[1],
                               debug = debug,
                               debugCodePaths = True,
                               debugWamp = debug)
   factory.protocol = HeartbeatClientProtocol
   connectWS(factory)

   reactor.run()
开发者ID:luodaobin,项目名称:scratchbox,代码行数:30,代码来源:client.py


注:本文中的autobahn.wamp.WampClientFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。