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


Python WampServerFactory.setProtocolOptions方法代码示例

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


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

示例1: __init__

# 需要导入模块: from autobahn.wamp import WampServerFactory [as 别名]
# 或者: from autobahn.wamp.WampServerFactory import setProtocolOptions [as 别名]
	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,代码行数:10,代码来源:server.py

示例2: runServer

# 需要导入模块: from autobahn.wamp import WampServerFactory [as 别名]
# 或者: from autobahn.wamp.WampServerFactory import setProtocolOptions [as 别名]
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,代码行数:18,代码来源:server.py

示例3: runwamp

# 需要导入模块: from autobahn.wamp import WampServerFactory [as 别名]
# 或者: from autobahn.wamp.WampServerFactory import setProtocolOptions [as 别名]
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,代码行数:26,代码来源:tasks.py

示例4: DirWatchServerProtocol

# 需要导入模块: from autobahn.wamp import WampServerFactory [as 别名]
# 或者: from autobahn.wamp.WampServerFactory import setProtocolOptions [as 别名]
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,代码行数:32,代码来源:server.py

示例5: PubSubServer1

# 需要导入模块: from autobahn.wamp import WampServerFactory [as 别名]
# 或者: from autobahn.wamp.WampServerFactory import setProtocolOptions [as 别名]
from autobahn.websocket import listenWS
from autobahn.wamp import WampServerFactory, \
                          WampServerProtocol


class PubSubServer1(WampServerProtocol):
    def onSessionOpen(self):
        ## register a single, fixed URI as PubSub topic
        self.registerForPubSub("http://leddimmer.unserHaus.name/event")
        
        ## register a URI and all URIs having the string as prefix as PubSub topic
        self.registerForPubSub("http://leddimmer.unserHaus.name/event#", True)

if __name__ == '__main__':
    log.startLogging(sys.stdout)
    debug = len(sys.argv) > 1 and sys.argv[1] == 'debug'
    debug = True
    
    factory = WampServerFactory("ws://localhost:9000", debugWamp=debug)
    factory.protocol = PubSubServer1
    factory.setProtocolOptions(allowHixie76=True,
                          tcpNoDelay=True)
    listenWS(factory)
    
    webdir = File(".")
    web = Site(webdir)
    reactor.listenTCP(8080, web)
    
    reactor.run()
开发者ID:Boman,项目名称:ledDimmer,代码行数:31,代码来源:ws_server.py

示例6: deferLater

# 需要导入模块: from autobahn.wamp import WampServerFactory [as 别名]
# 或者: from autobahn.wamp.WampServerFactory import setProtocolOptions [as 别名]
            msg = "%s connected from %s" % (authKey,peer)
        self.currentUser = authKey
        self.currentRole = 'default'
        deferLater( reactor, 1, lambda: NotificationProtocol.notify(msg) )



f = WampServerFactory( "ws://localhost:2001", debugWamp=True )
f.protocol = WorkflowProtocol
#
# allowHixie76=True is required in order to work with iOS and Safari,
# but this is insecure
#
# see https://groups.google.com/forum/?fromgroups=#!topic/autobahnws/wOEU3Bvp4HQ

f.setProtocolOptions( allowHixie76=True )
listenWS(f)
NotificationProtocol.start()

from twisted.python import log

reactor.listenTCP( 2000, Site( root ) )
import sys
log.startLogging( sys.stdout )
log.msg( "starting" )

from application import MODULE
app = MODULE.Application()
app.start()

reactor.run()
开发者ID:dkolbly,项目名称:flowman,代码行数:33,代码来源:webapp.py


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