让 Pusher JS 客户端在 PhantomJS 中工作

Getting the Pusher JS client working in PhantomJS

在 selenium 测试期间使用 PhantomJS 时,我无法连接 Pusher 客户端。图书馆永远不会脱离连接。

控制台日志:

Pusher : State changed : initialized -> connecting (undefined:undefined)
Pusher : Connecting : {"transport":"ws","url":"wss://ws.pusherapp.com:443/app/8f2c58afe761d56c83dc?protocol=7&client=js&version=3.0.0&flash=false"} (undefined:undefined)
binded (undefined:undefined)
Pusher : State changed : connecting -> unavailable (undefined:undefined)
Pusher : Connecting : {"transport":"ws","url":"wss://ws.pusherapp.com:443/app/8f2c58afe761d56c83dc?protocol=7&client=js&version=3.0.0&flash=false"} (undefined:undefined)
Pusher : Connecting : {"transport":"ws","url":"wss://ws.pusherapp.com:443/app/8f2c58afe761d56c83dc?protocol=7&client=js&version=3.0.0&flash=false"} (undefined:undefined)

Here 是 Django 中出现此问题的一个小项目。

PhantomJS 似乎在 websocket 方面存在一些问题。这些问题在 2.0 中得到修复。安装 phantomjs 2.0 解决了这个问题。