Exemplo n.º 1
0
    def __call__(self, environ, start_response):
        if environ['CONTENT_TYPE'] == self.CONTENT_TYPE:
            # Regular AMF message
            return WsgiChannel.__call__(self, environ, start_response)

        # Create streaming message command
        try:
            msg = messaging.StreamingMessage()
            msg.parseParams(environ['QUERY_STRING'])

            body = environ['wsgi.input'].read(int(environ['CONTENT_LENGTH']))
            msg.parseBody(body)
        except (KeyboardInterrupt, SystemExit):
            raise
        except Exception, exc:
            amfast.log_exc(exc)
            return self.badServer(start_response, self.getBadServerMsg())
Exemplo n.º 2
0
                      dest="port",
                      help="port number to serve")
    parser.add_option("-d",
                      default="localhost",
                      dest="domain",
                      help="domain to serve")
    parser.add_option("-l",
                      action="store_true",
                      dest="log_debug",
                      help="log debugging output")
    (options, args) = parser.parse_args()

    amfast.log_debug = options.log_debug

    channel_set = WsgiChannelSet()
    rpc_channel = WsgiChannel('amf')
    channel_set.mapChannel(rpc_channel)
    utils.setup_channel_set(channel_set)

    server = simple_server.WSGIServer((options.domain, int(options.port)),
                                      simple_server.WSGIRequestHandler)

    server.set_app(channel_set)

    try:
        print "Serving on %s:%s" % (options.domain, options.port)
        print "Press ctrl-c to halt."
        server.serve_forever()
    except KeyboardInterrupt:
        pass
Exemplo n.º 3
0
    def __init__(self, name, max_connections=-1, endpoint=None, wait_interval=0, heart_interval=30000):
        WsgiChannel.__init__(self, name, max_connections=max_connections,
            endpoint=endpoint, wait_interval=wait_interval)

        self.heart_interval = heart_interval
Exemplo n.º 4
0
    parser.add_option("-l",
                      action="store_true",
                      dest="log_debug",
                      help="log debugging output")
    (options, args) = parser.parse_args()

    amfast.log_debug = options.log_debug

    cp_options = {
        'global': {
            'server.socket_port': int(options.port),
            'server.socket_host': str(options.domain),
        },
        '/': {
            'tools.staticdir.on': True,
            'tools.staticdir.dir': os.path.join(os.getcwd(), '../flex/deploy')
        }
    }

    channel_set = ChannelSet()
    rpc_channel = WsgiChannel('amf-channel', endpoint=PyAmfEndpoint())
    channel_set.mapChannel(rpc_channel)
    utils.setup_channel_set(channel_set)

    app = App()
    cherrypy.tree.graft(rpc_channel, '/amf')
    cherrypy.quickstart(app, '/', config=cp_options)

    print "Serving on %s:%s" % (options.domain, options.port)
    print "Press ctrl-c to halt."
Exemplo n.º 5
0
 def __init__(self):
     self.channel_set = ChannelSet()
     rpc_channel = WsgiChannel('amf-channel', endpoint=PyAmfEndpoint())
     self.channel_set.mapChannel(rpc_channel)
     utils.setup_channel_set(self.channel_set)
Exemplo n.º 6
0
 def __init__(self):
     self.channel_set = ChannelSet()
     rpc_channel = WsgiChannel('amf-channel')
     self.channel_set.mapChannel(rpc_channel)
     utils.setup_channel_set(self.channel_set)
Exemplo n.º 7
0
            'server.socket_port': int(options.port),
            'server.socket_host': str(options.domain),
        },
        '/': {
            'tools.staticdir.on': True,
            'tools.staticdir.dir': os.path.join(os.getcwd(), '../flex/deploy')
        }
    }

    channel_set = WsgiChannelSet(notify_connections=False)

    # Clients connect every x seconds
    # to polling channels to check for messages.
    # If messages are available, they are
    # returned to the client.
    polling_channel = WsgiChannel('amf')
    channel_set.mapChannel(polling_channel)

    # Long-poll channels do not return
    # a response to the client until
    # a message is available, or channel.max_interval
    # is reached.
    long_poll_channel = WsgiChannel('longPoll', wait_interval=90)
    channel_set.mapChannel(long_poll_channel)

    app = App()
    cherrypy.tree.graft(polling_channel, '/amf')
    cherrypy.tree.graft(long_poll_channel, '/longPoll')
    cherrypy.quickstart(app, '/', config=cp_options)

    print "Serving on %s:%s" % (options.domain, options.port)
Exemplo n.º 8
0
    parser.add_option("-l",
                      action="store_true",
                      dest="log_debug",
                      help="log debugging output")
    (options, args) = parser.parse_args()

    amfast.log_debug = options.log_debug

    cp_options = {
        'global': {
            'server.socket_port': int(options.port),
            'server.socket_host': str(options.domain),
        },
        '/': {
            'tools.staticdir.on': True,
            'tools.staticdir.dir': os.path.join(os.getcwd(), '../flex/deploy')
        }
    }

    channel_set = ChannelSet()
    rpc_channel = WsgiChannel('amf-channel')
    channel_set.mapChannel(rpc_channel)
    utils.setup_channel_set(channel_set)

    app = App()
    cherrypy.tree.graft(rpc_channel, '/amf')
    cherrypy.quickstart(app, '/', config=cp_options)

    print "Serving on %s:%s" % (options.domain, options.port)
    print "Press ctrl-c to halt."