无法使Autobahn示例正常工作(js和python) - javascript

我正在尝试使用AutobahnPython和AutobahnJS库开始使用WAMP,但是我无法使用正式示例。
这是我所做的:

pip-2.7 install autobahn    # this gave me ab 0.5.14, but I tried 0.6-git too
git clone git://github.com/tavendo/AutobahnPython.git
git checkout maintenance_v0_5
cd AutobahnPython/examples/wamp/authentication/
python2.7 server.py debug
firefox http://localhost:8080

并且在服务器的调试输出中得到以下信息:

2013-03-29 15:11:23+0100 [-] Log opened.
2013-03-29 15:11:23+0100 [-] WampServerFactory starting on 9000
2013-03-29 15:11:23+0100 [-] Starting factory <autobahn.wamp.WampServerFactory instance at 0x132b5a8>
2013-03-29 15:11:23+0100 [-] WampServerFactory starting
2013-03-29 15:11:23+0100 [-] Site starting on 8080
2013-03-29 15:11:23+0100 [-] Starting factory <twisted.web.server.Site instance at 0x1779b90>
2013-03-29 15:11:28+0100 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [29/Mar/2013:14:11:27 +0000] "GET / HTTP/1.1" 200 3429 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"
2013-03-29 15:11:29+0100 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [29/Mar/2013:14:11:28 +0000] "GET /favicon.ico HTTP/1.1" 404 145 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"
2013-03-29 15:11:29+0100 [MyServerProtocol,0,127.0.0.1] TX WAMP: [0, "H0tcxzZW7g2aUKQ4", 1, "Autobahn/0.5.14"]
2013-03-29 15:11:29+0100 [MyServerProtocol,0,127.0.0.1] registered remote method on http://api.wamp.ws/procedure#auth
2013-03-29 15:11:29+0100 [MyServerProtocol,0,127.0.0.1] registered remote method on http://api.wamp.ws/procedure#authreq
2013-03-29 15:11:29+0100 [HTTPChannel,0,127.0.0.1] 127.0.0.1 - - [29/Mar/2013:14:11:28 +0000] "GET /favicon.ico HTTP/1.1" 404 145 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox/19.0"
2013-03-29 15:11:29+0100 [MyServerProtocol,0,127.0.0.1] RX WAMP: [2,"0.42w1p52zq5g","http://api.wamp.ws/procedure#authreq","foobar",null]
2013-03-29 15:11:29+0100 [MyServerProtocol,0,127.0.0.1] TX WAMP: [3, "0.42w1p52zq5g", "{\"extra\": {}, \"timestamp\": \"2013-03-29T14:11:29Z\", \"authid\": \"PmRmYauw3-2S_4Wh\", \"authkey\": \"foobar\", \"sessionid\": \"H0tcxzZW7g2aUKQ4\", \"authextra\": {\"keylen\": 32, \"salt\": \"RANDOM SALT\", \"iterations\": 10000}, \"permissions\": {\"rpc\": [{\"call\": true, \"uri\": \"http://example.com/procedures/hello\"}], \"pubsub\": [{\"prefix\": true, \"uri\": \"http://example.com/topics/\", \"pub\": true, \"sub\": true}]}}"]
2013-03-29 15:11:29+0100 [MyServerProtocol,0,127.0.0.1] RX WAMP: [2,"0.35zpscr4dpf","http://api.wamp.ws/procedure#auth","4xs7OnDnqHP+DiMqLnK95s36eiEhMRbkbUcRPJRHoOY="]

最后是服务器和客户端的以下错误(浏览器日志):

2013-03-29 15:11:29+0100 [MyServerProtocol,0,127.0.0.1] TX WAMP: [4, "0.35zpscr4dpf", "http://api.wamp.ws/error#invalid-signature", "signature for authentication request is invalid"]
2013-03-29 15:11:34+0100 [MyServerProtocol,0,127.0.0.1] RX WAMP: [7,"http://example.com/topics/mytopic1","Hello, world!"]
2013-03-29 15:11:34+0100 [MyServerProtocol,0,127.0.0.1] no topic / publication handler registered for http://example.com/topics/mytopic1

怎么了这是我的错吗?

参考方案

不,您没有做错任何事情。使用当前的主分支机头(不维护0.5)。盐腌的WAMP-CRA身份验证(本示例使用的)具有固定的某些内容,不在维护0.5上。对不起,麻烦。

这是Firefox连接的服务器日志:

oberstet@THINKPAD-T410S /f/scm/AutobahnPython/examples/wamp/authentication (master)
$ git log -1
commit f3165c51256334b97e6183bd0852c3102882e917
Author: Tobias Oberstein <[email protected]>
Date:   Tue Mar 26 12:15:52 2013 +0100

    add multiple protocols example

oberstet@THINKPAD-T410S /f/scm/AutobahnPython/examples/wamp/authentication (master)
$ python server.py debug
Auth Extra/Secrets
{'keylen': 32, 'salt': 'RANDOM SALT', 'iterations': 1000}
{'foobar': 'znWa4bxY1glpbQlZziHIlXA2shfF+HoCr9bnmZ5HPQg='}
2013-03-29 19:17:42+0100 [-] Log opened.
2013-03-29 19:17:42+0100 [-] WampServerFactory starting on 9000
2013-03-29 19:17:42+0100 [-] Starting factory <autobahn.wamp.WampServerFactory instance at 0x02934BC0>
2013-03-29 19:17:42+0100 [-] WampServerFactory starting
2013-03-29 19:17:42+0100 [-] Site starting on 8080
2013-03-29 19:17:42+0100 [-] Starting factory <twisted.web.server.Site instance at 0x036FDE18>
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] TX WAMP: [0, "7LHl79cVQEDZl_C5", 1, "Autobahn/0.6.0"]
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] registered remote method on http://api.wamp.ws/procedure#auth
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] registered remote method on http://api.wamp.ws/procedure#authreq
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] RX WAMP: [2,"0.c23s5q4pxf","http://api.wamp.ws/procedure#authreq","foobar",null]
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] TX WAMP: [3, "0.c23s5q4pxf", "{\"extra\": {}, \"timestamp\": \"2013-03-29T18:17:42Z\
", \"authid\": \"7NEQK0Gnrqxq1JRL\", \"authkey\": \"foobar\", \"sessionid\": \"7LHl79cVQEDZl_C5\", \"authextra\": {\"keylen\": 32, \"salt\":
 \"RANDOM SALT\", \"iterations\": 1000}, \"permissions\": {\"rpc\": [{\"call\": true, \"uri\": \"http://example.com/procedures/hello\"}], \"
pubsub\": [{\"prefix\": true, \"uri\": \"http://example.com/topics/\", \"pub\": true, \"sub\": true}]}}"]
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] RX WAMP: [2,"0.fscffb2cozr","http://api.wamp.ws/procedure#auth","LzKbKJb5K8D313P/bl1
tF4Z93bIZup8oR8+Am8PY8mc="]
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] registered topic http://example.com/topics/ for publication (match by prefix = True)

2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] registered topic http://example.com/topics/ for subscription (match by prefix = True
)
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] registered remote method on http://example.com/procedures/hello
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] TX WAMP: [3, "0.fscffb2cozr", {"rpc": [{"call": true, "uri": "http://example.com/pro
cedures/hello"}], "pubsub": [{"prefix": true, "uri": "http://example.com/topics/", "pub": true, "sub": true}]}]
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] RX WAMP: [5,"http://example.com/topics/mytopic1"]
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] subscriptions map created for topic http://example.com/topics/mytopic1
2013-03-29 19:17:42+0100 [MyServerProtocol,1,127.0.0.1] subscribed peer 127.0.0.1:55946 on topic http://example.com/topics/mytopic1

Mongo汇总 - javascript

我的收藏中有以下文件{ "_id": ObjectId("54490b8104f7142f22ecc97f"), "title": "Sample1", "slug": "samplenews", "cat": …

如何在JQuery中操作JSONArray - javascript

我有一个php函数,它以JSON返回此代码{"0":{"title":"Dans l\u2019appartement"},"1":{"title":"A l\u2019a\u00e9roport - D\u00e9part de B\u00e9at…

和字符中断通过PHP接收JSON - javascript

我有一个包含更多对象的数组。如果一个对象包含&字符,则php不会接收&之后的每个对象。可能是什么问题?这就是阿贾克斯xmlhttp.open("POST", "get.php"); xmlhttp.setRequestHeader("Content-Type", "application/…

编码JSON数据以保留json格式 - javascript

由于JSON值是动态生成的,并且其中的值是基于用户输入的,因此,如果用户在字符串中输入了不可接受的字符(如"),则会使json无效。就像是:{ "tag" : "demo", "value": "user " input" } 有没有一种方法可以编码或转义JS…

选择后显示输入元素 - javascript

我有一个表格,其中取决于用户的选择,输入元素是否可见。实际上,用户正在以另一种形式设置已定义的合作伙伴类型,并且如果选中该元素,则允许在该类型的合作伙伴上可见的元素类型1将显示以下元素:<input type="text" id="partner" name="partner" class=&…