Tag: wamp protocol

AutobahnJS:远程调用asynchronous函数

我试图通过WAMP拨打一个远程function。 但是如果它有asynchronous行为,我不知道如何编写被调用的函数。 在我看到的每个例子中,远程函数都返回结果。 如何以asynchronous的方式来完成,我通常会使用callback? 例子:这是一个函数的注册,它将asynchronous获取文件的内容。 session.register('com.example.getFileContents', getFileContents).then( function (reg) { console.log("procedure getFileContents() registered"); }, function (err) { console.log("failed to register procedure: " + err); } ); 以下是我将如何远程调用该function。 session.call('com.example.getFileContents', ["someFile.txt"]).then( function (res) { console.log("File Contents:", res); }, function (err) { console.log("Error getting file contents:", err); } ); 但是这是注册的实际function。 function getFileContents(file) { fs.readFile(file, 'utf8', function(err, data) { […]

如何让Poloniex推送API数据与Wampy

我想获得正确的数据连接到Poloniex推送API使用Wamp协议Wampy.js实现http://wamp-proto.org/implementations/ 但是我只有最后两个数据types,第一个保持给我“seq”: { “序列”:76722908} [ “BTC_ETH”, “0.02027380”, “0.02027377”, “0.02027355”, “0.06151162”, “29539.50716156”, “1478656.69569076”,0, “0.02097800”, “0.01865820”] [“trollboxMessage”,8755461,“reorx2112”,“made mill alrdy”,9] 官方的例子和http://pastebin.com/dMX7mZE0他们使用autobahn node.js模块 这是我的代码如下 脚本src =“node_modules / wampy / build / wampy-all.min.js”脚本> <pre> ws = new Wampy('wss://api.poloniex.com', {realm: "realm1"}); ws.onopen = function () { // //subscribe to currency pair //this data type is not correct //while other data looks […]

无法在我的node.js项目的wamp套接字中configurationssl

我用angular-wamp作为客户端, Crossbar作为路由器。 当我没有ssl(https)使用它时,WAMP是完美的工作。 但是当我试图实现安全的WebSocket它给这样的错误在控制台中: WAMP connection closed unreachable { reason: null, message: null, retry_delay: 2.052066390813223, retry_count: 2, will_retry: true } 但在浏览器中显示恭喜! 你连接到WAMP服务器! 我已经使用wss:// localhost:8080 / ws作为连接的URL。 使用此链接作为参考https://github.com/crossbario/crossbarexamples Node.js服务器在3000端口上运行。 卡住严重,任何帮助将不胜感激。 我已经接受了本地主机以及127.0.0.1的临时不安全authentication(通常是我们的自我authentication),但仍然得到了以下的东西。 在浏览器日志中: 恭喜! 你连接到WAMP服务器! 我已经接受了自签名authentication(localhost和127.0.0.1):