我正在尝试在heroku上设置Weinre ,但我遇到了一些问题。
我设法构建了应用程序,只需使用带有 weinre npm 依赖项的 package.json 和如下所示的 Procfile
web: node_modules/weinre/weinre --httpPort $PORT
起初一切似乎都正常,客户端显示了 UI,JS 文件加载正常,但调试不起作用,并且没有客户端出现在服务器端。
在查看日志时,我意识到对于每个包含 /ws/target/* 或 /ws/client/* 的请求,我都会收到 404 错误
2012-05-31T22:37:53+00:00 heroku[router]: GET xxxx.herokuapp.com/target/target-script.js dyno=web.1 queue=0 wait=0ms service=10ms status=200 bytes=190900
2012-05-31T22:37:36+00:00 heroku[router]: GET xxxx.herokuapp.com/ws/target/t-3 dyno=web.1 queue=0 wait=0ms service=3ms status=404 bytes=9
2012-05-31T22:36:39+00:00 heroku[router]: POST xxxx.herokuapp.com/ws/client/c-1 dyno=web.1 queue=0 wait=0ms service=40ms status=404 bytes=9
此设置在本地运行没有问题。
我也尝试了 Procilfe--boundHost 0.0.0.0
并得到了同样的错误。当我使用我的 heroku 应用程序域/子域作为主机时出现weinre: error running server: Error: listen EADDRNOTAVAIL
错误
如果需要,您可以在github 存储库中查看源代码
https://github.com/felipesabino/weinre-heroku
编辑:这可能与 Heroku 不支持 WebSockets 有关: https ://devcenter.heroku.com/articles/http-routing#websockets
最奇怪的是,PhoneGap 的 weinre 调试页面也发生了同样的问题 http://debug.phonegap.com/
有谁知道如何解决这个问题?