3

我们在 Redhat (Red Hat 4.8.3-9) 上使用 python 2.7.5 并尝试在 Autobahn Python 中运行简单的 helloworld,同时启动服务器,我们收到以下错误:

# python AppSession.py
2016-03-22T19:09:03+0530 failing WebSocket opening handshake ('HTTP Sec-WebSocket-Accept bogus value : expected qXfIBc/WjD8wdE5cwhgu67waHX0= / got qxfibc/wjd8wde5cwhgu67wahx0=')

您的帮助将不胜感激。

谢谢

以下是我的代码:

from twisted.internet.defer import inlineCallbacks
from twisted.logger import Logger

from autobahn.twisted.util import sleep
from autobahn.twisted.wamp import ApplicationSession, Application
import datetime
import six
import sys


def __memory_and_swap_usage():
    # some code
    return True


def __memory_usage_load():
    # some code
    return True


def memory_usage_load():
    return __memory_usage_load()

def memory_and_swap_usage():
    return __memory_and_swap_usage()


class AppSession(Application):

    log = Logger()

    @inlineCallbacks
    def onJoin(self, details):

        # REGISTER a procedure for remote calling
        #

        yield self.register(memory_and_swap_usage, 'com.example.today_rpc')
        self.log.info("procedure today_rpc() registered")

        # PUBLISH and CALL every second .. forever
        #
        now = memory_and_swap_usage()
        while True:

            # PUBLISH an event
            #
            yield self.publish('com.example.ondatetimenow', now)
            self.log.info("published to 'ondatetimenow' with timestamp {now}",
                          now=now)
            now = memory_and_swap_usage()

            yield sleep(1)


if __name__ == '__main__':
    app = AppSession()
    app.run(url=u"ws://{0}:{1}".format('0.0.0.0', 8091))
4

0 回答 0