用于连接到 Heroku WebSocket 端点的 URI
URI for connecting to Heroku WebSocket endpoint
我们在 http://ourapp.com
处有一个 Java Web 应用程序托管在 Heroku 上,该应用程序的前端无法连接到 WebSocket 端点 (endpoint
) 运行 Heroku 测功机。我们已经尝试了这些 URI:
ws://ourapp.com/endpoint
ws://ourapp.com:80/endpoint
ws://ourapp.com:8080/endpoint
ws://ourapp.com:8084/endpoint
ws://ourapp.com:443/endpoint
wss://ourapp.com/endpoint
wss://ourapp.com:80/endpoint
wss://ourapp.com:8080/endpoint
wss://ourapp.com:8084/endpoint
wss://ourapp.com:443/endpoint
上面的None打开一个连接。我们在这里缺少什么?
PS:我已经设置了一个测试场地:http://vakuutustiedot-dev.herokuapp.com/websocket.test.html(URI是PROTOCOL:vakuutustiedot-dev.herokuapp.com:PORT/trial
)
目标应用程序在 Heroku Apache Tomcat 8.5.38 中运行。
端口号是怎么回事,不知道怎么弄。
也许您错过了向 Heroku 添加 WebSockets 的支持,就像在这个答案中一样 ()?
也许您应该尝试配置 devServer
的 proxy
属性。当前端应用程序和后端 api 不在同一主机上 运行 时,使用此属性。也许以下设置可以解决您的问题。
module.exports = {
devServer: {
proxy: 'ws://ourapp.com:8080/endpoint'
}
}
有关详细信息,请参阅文档:https://cli.vuejs.org/config/#devserver
我们在 http://ourapp.com
处有一个 Java Web 应用程序托管在 Heroku 上,该应用程序的前端无法连接到 WebSocket 端点 (endpoint
) 运行 Heroku 测功机。我们已经尝试了这些 URI:
ws://ourapp.com/endpoint
ws://ourapp.com:80/endpoint
ws://ourapp.com:8080/endpoint
ws://ourapp.com:8084/endpoint
ws://ourapp.com:443/endpoint
wss://ourapp.com/endpoint
wss://ourapp.com:80/endpoint
wss://ourapp.com:8080/endpoint
wss://ourapp.com:8084/endpoint
wss://ourapp.com:443/endpoint
None打开一个连接。我们在这里缺少什么?
PS:我已经设置了一个测试场地:http://vakuutustiedot-dev.herokuapp.com/websocket.test.html(URI是PROTOCOL:vakuutustiedot-dev.herokuapp.com:PORT/trial
)
目标应用程序在 Heroku Apache Tomcat 8.5.38 中运行。 端口号是怎么回事,不知道怎么弄。
也许您错过了向 Heroku 添加 WebSockets 的支持,就像在这个答案中一样 (
也许您应该尝试配置 devServer
的 proxy
属性。当前端应用程序和后端 api 不在同一主机上 运行 时,使用此属性。也许以下设置可以解决您的问题。
module.exports = {
devServer: {
proxy: 'ws://ourapp.com:8080/endpoint'
}
}
有关详细信息,请参阅文档:https://cli.vuejs.org/config/#devserver