예제 #1
0
파일: server.py 프로젝트: rasata/octopus
	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
0
	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
예제 #3
0
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)
예제 #4
0
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()
예제 #5
0
파일: tasks.py 프로젝트: am1ty9d9v/oposod
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()
예제 #6
0
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()
예제 #7
0
        self.registerForPubSub("http://example.com/event#",
                               True,
                               pubsub=WampServerProtocol.SUBSCRIBE)
        #reactor.callLater(5, self.sendEvent)

    #def sendEvent(self, event):
    #    self.dispatch("http://example.com/simple", event)


if __name__ == '__main__':
    log.startLogging(sys.stdout)

    # websocket stuff
    debug = len(sys.argv) > 1 and sys.argv[1] == 'debug'
    factory = WampServerFactory("ws://0.0.0.0:9000", debugWamp=debug)
    factory.protocol = PubSubServer
    factory.setProtocolOptions(allowHixie76=True)
    listenWS(factory)

    # rabbitmq stuff
    parameters = pika.ConnectionParameters()
    cc = protocol.ClientCreator(reactor,
                                twisted_connection.TwistedProtocolConnection,
                                parameters)
    d = cc.connectTCP('localhost', 5672)
    d.addCallback(lambda protocol: protocol.ready)
    pika_consumer = PikaConsumer(factory)
    d.addCallback(pika_consumer.run)

    reactor.run()
예제 #8
0
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()
예제 #9
0
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()
예제 #10
0
파일: webapp.py 프로젝트: dkolbly/flowman
            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()