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


Python wamp.WampServerFactory类代码示例

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


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

示例1: __init__

	def __init__(self, port = 9000, debug = False):
		self.port = port
		self.debug = debug

		factory = WampServerFactory("ws://localhost:%d" % self.port, debug = self.debug)
		factory.protocol = LabspiralServerProtocol
		factory.setProtocolOptions(allowHixie76 = True) # needed if Hixie76 is to be supported
		self.factory = factory
开发者ID:rasata,项目名称:octopus,代码行数:8,代码来源:server.py

示例2: startFactory

   def startFactory(self):
      WampServerFactory.startFactory(self)
      log.msg("AdminWebSocketFactory started [speaking %s]" % self.protocols)

      log.msg("debugWamp: %s" % self.debugWamp)
      log.msg("debugApp: %s" % self.debugApp)

      self.updateAvailable = {"update-available": False}
      self.autocheckForUpdates()
开发者ID:Inspire2Innovate,项目名称:crossbar,代码行数:9,代码来源:adminwebsocket.py

示例3: __init__

   def __init__(self, url, debug = False):
      WampServerFactory.__init__(self, url, debugWamp = debug)
      self.setProtocolOptions(allowHixie76 = True)

      ## the key-value store resides on the factory object, since it is to
      ## be shared among all client connections
      self.keyvalue = KeyValue("keyvalue.dat")

      decimal.getcontext().prec = 20
开发者ID:MichalMazurek,项目名称:AutobahnTestSuite,代码行数:9,代码来源:wamptestserver.py

示例4: __init__

   def __init__(self, url, dbpool, services):
      WampServerFactory.__init__(self, url, debug = False, debugWamp = False)
      self.dbpool = dbpool
      self.services = services
      self.stats = {'ws-connections': 0,
                    'ws-publications': 0,
                    'ws-dispatched-success': 0,
                    'ws-dispatched-failed': 0}
      self.statsChanged = False

      self.trackingCookies = {}
开发者ID:jamjr,项目名称:crossbar,代码行数:11,代码来源:hubwebsocket.py

示例5: WebSocketServer

class WebSocketServer():
    server = None

    def __init__(self, port, debug):
        if debug:
            log.startLogging(sys.stdout)

        self.server = WampServerFactory("ws://localhost:"+ str(port), debug)
        self.server.protocol = LogeeProtocol
        listenWS(self.server)

    def broadcast(self, topic, message):
        self.server.dispatch(topic, message)
开发者ID:codename-heroes,项目名称:pervastered-interface,代码行数:13,代码来源:websocket_server.py

示例6: __init__

   def __init__(self, config):
      self.config = config
      WampServerFactory.__init__(self, config.wsuri, debugWamp = config.debug)

      self.setProtocolOptions(failByDrop = False)

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

      if config.allowunmasked:
         self.setProtocolOptions(requireMaskedClientFrames = False)

      print "Load/Latency Broker listening on %s [skiputf8validate = %s, allowunmasked = %s]" % (config.wsuri, config.skiputf8validate, config.allowunmasked)
开发者ID:boonedox,项目名称:AutobahnPython,代码行数:13,代码来源:server.py

示例7: __init__

    def __init__(self, port, debug):
        if debug:
            log.startLogging(sys.stdout)

        self.server = WampServerFactory("ws://localhost:"+ str(port), debug)
        self.server.protocol = LogeeProtocol
        listenWS(self.server)
开发者ID:codename-heroes,项目名称:pervastered-interface,代码行数:7,代码来源:websocket_server.py

示例8: runServer

def runServer():
    if len(sys.argv) > 1 and sys.argv[1] == 'debug':
        log.startLogging(sys.stdout)
        debug = True
    else:
        debug = False

    factory = WampServerFactory("ws://localhost:9000", debug=False, debugCodePaths=False, debugWamp=debug, debugApp=False)
    factory.protocol = AppServerProtocol
    factory.setProtocolOptions(allowHixie76 = True)
    listenWS(factory)

    webdir = File(".")
    web = Site(webdir)
    reactor.listenTCP(8080, web)
    reactor.run(installSignalHandlers=0)
开发者ID:DamnedFacts,项目名称:Vernacular,代码行数:16,代码来源:server.py

示例9: dispatch

 def dispatch(self, topicUri, event, exclude = [], eligible = None):
    """
    Normal dispatch from a WAMP client publish.
    """
    d = WampServerFactory.dispatch(self, topicUri, event, exclude, eligible)
    d.addCallback(self.logNormalDispatch)
    return d
开发者ID:jamjr,项目名称:crossbar,代码行数:7,代码来源:hubwebsocket.py

示例10: dispatchHubEvent

 def dispatchHubEvent(self, topicuri, event, exclude = [], eligible = None):
    """
    Dispatch from a REST API Push.
    """
    if exclude:
       exclude = self.sessionIdsToProtos(exclude)
    if eligible:
       eligible = self.sessionIdsToProtos(eligible)
    return WampServerFactory.dispatch(self, topicuri, event, exclude, eligible)
开发者ID:jamjr,项目名称:crossbar,代码行数:9,代码来源:hubwebsocket.py

示例11: __init__

   def __init__(self, config):
      self.config = config
      WampServerFactory.__init__(self, config.wsuri, debugWamp = config.debug)

      self.setProtocolOptions(failByDrop = False)

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

      if config.allowunmasked:
         self.setProtocolOptions(requireMaskedClientFrames = False)

      self.connectedClients = set()

      print "Load/Latency Broker listening on %s [skiputf8validate = %s, allowunmasked = %s]" % (config.wsuri, config.skiputf8validate, config.allowunmasked)

      def printstats():
         print "%d clients connected" % len(self.connectedClients)
         reactor.callLater(1, printstats)

      printstats()
开发者ID:andrewgsoler,项目名称:AutobahnPython,代码行数:21,代码来源:server.py

示例12: run_server

def run_server ():
	reactor.listenTCP(8789, pb.PBServerFactory(ExperimentMarshal()))
	log.msg("PB listening on port 8789")

	factory = WampServerFactory("ws://localhost:9000")
	factory.protocol = LabspiralServerProtocol
	listenWS(factory)
	log.msg("WS listening on port 9000")

	ExperimentMarshal.publish = factory.dispatch

	root = resource.Resource()
	root.putChild("", Root())
	root.putChild("experiments", ExperimentList())
	root.putChild("resources", static.File("resources"))
	site = server.Site(root)
	reactor.listenTCP(8001, site)
	log.msg("HTTP listening on port 8001")

	reactor.run()

	log.msg("Server stopped")
开发者ID:rasata,项目名称:octopus,代码行数:22,代码来源:server.py

示例13: runwamp

def runwamp(logfile=None, debug=True):
    if logfile is None:
        log.startLogging(sys.stdout)

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

    factory = ""
    host_name = socket.gethostname()
    if host_name == 'ip-172-31-29-49':
        factory = WampServerFactory("ws://oposod.com:9000", debugWamp=None)
    else:
        factory = WampServerFactory("ws://localhost:9000", debugWamp=debug)
    factory.protocol = PubSubServer1
    factory.setProtocolOptions(allowHixie76=True)
    listenWS(factory)

    webdir = File(".")
    web = Site(webdir)
    reactor.listenTCP(9090, web)

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

示例14: DirWatchServerProtocol

from twisted.web.static import File

from autobahn.twisted.websocket import listenWS
from autobahn.wamp import WampServerFactory, \
                          WampServerProtocol


class DirWatchServerProtocol(WampServerProtocol):

   def onSessionOpen(self):

      ## register a URI and all URIs having the string as prefix as PubSub topic
      self.registerForPubSub("http://dirwatch.autobahn.ws", True)


if __name__ == '__main__':

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

   factory = WampServerFactory("ws://localhost:9000", debugWamp = debug)
   factory.protocol = DirWatchServerProtocol
   factory.setProtocolOptions(allowHixie76 = True)
   listenWS(factory)

   webdir = File(".")
   web = Site(webdir)
   reactor.listenTCP(8080, web)

   reactor.run()
开发者ID:andrewgsoler,项目名称:AutobahnPython,代码行数:30,代码来源:server.py

示例15: __init__

 def __init__(self, url, dbpool, services):
    WampServerFactory.__init__(self, url, debugApp = False)
    self.dbpool = dbpool
    self.services = services
    self.restartRequired = False
开发者ID:Inspire2Innovate,项目名称:crossbar,代码行数:5,代码来源:adminwebsocket.py


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