本文整理汇总了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
示例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)
示例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()
示例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()
示例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()
示例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()