意外响应代码:426 与 PhantomJS Websocket 客户端/ROSLIB [英] Unexpected response code: 426 with PhanthomJS Websocket client/ROSLIB

查看:73
本文介绍了意外响应代码:426 与 PhantomJS Websocket 客户端/ROSLIB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 PhanthomJS (1.9.7) 设置批处理测试脚本,以通过我们的 Websocket 服务器(在 Tornado 之上实现的 RosBridge)驱动我们的机器人软件.

I'm trying to use PhanthomJS (1.9.7) to setup batch test script to drive our robotics software over our Websocket server (RosBridge which is implemented on top of Tornado).

我们使用 ROSLIBJS,这是一个使用标准 HTML5 WebSocket API 与服务器交互的 JS 库.我更喜欢使用 NodeJS 而不是 PhantomJS,但是 ROSLIBJS 中存在依赖项,需要浏览器 DOM 结构可用.有人为 NodeJS 移植了 ROSLIBJS.我让它运行了,但是有一些严重的错误阻止了它的使用.因此,我需要 PhantomJS.

We use ROSLIBJS which is a JS library that uses the standard HTML5 WebSocket API to interact with the server. I would have preferred to use NodeJS instead of PhantomJS, but there are dependencies in the ROSLIBJS that requires browser DOM structures to be available. Someone ported ROSLIBJS for NodeJS. I got it running, but there were critical bugs that prevented it from being usable. Hence, I need PhantomJS.

根据此链接,与 Websocket 协议存在一些不兼容.意外的响应代码 426

According to this link, there is some incompatibility with the Websocket protocol. Unexpected response code 426

这是一个已知问题.如果是这样,什么时候会修复 PhantomJS 以使其正常工作?我可以轻松地自己修补 PhantomJS 吗?

Is that a known issue. If so, when would PhantomJS be fixed for this to work? Can I patch PhantomJS myself easily?

推荐答案

Http 426 可能意味着您正在尝试使用不受支持的 websocket 协议版本进行连接.检查响应是否具有 http 标头sec-websocket-version"以及支持的版本列表.

Http 426 may mean that you are trying to connect with an unsupported websocket protocol version. Check if the response has the http header "sec-websocket-version" with a list of supported versions.

您的客户使用的是哪个版本?

Which version is your client using?

此外,如果您通过代理连接,代理可能会从请求中删除升级"标头,因为它被标记为连接"标头.切换到 WSS://以防止出现这种情况.

Also, if you are connecting through a proxy, the proxy may remove the "upgrade" header from the request since it is marked as "connection" header. Switch to WSS:// to prevent that.

这篇关于意外响应代码:426 与 PhantomJS Websocket 客户端/ROSLIB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆