Heroku-Web 进程未能在启动后 90 秒内绑定到 $PORT.TooTallNate Websockets [英] Heroku- Web process failed to bind to $PORT within 90 seconds of launch. TooTallNate Websockets

查看:24
本文介绍了Heroku-Web 进程未能在启动后 90 秒内绑定到 $PORT.TooTallNate Websockets的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个完整的 websockets 服务器来侦听来自网站的连接.

I'm using a tootallnate websockets server listening for connections from a website.

如何在 heroku 上连接到我的服务器?

当我的网站尝试连接时

wss://Heroku-Name-39329.herokuapp.com/

wss://Heroku-Name-39329.herokuapp.com:5000/

我的 heroku 记录输出.

My heroku logs output.

at=error code=H10 desc="App crashed" method=GET path="/" host=wss://Heroku-Name-39329.herokuapp.com request_id=4afca002-2078-439c-85dc-ad6ef7db50d2 fwd="207.244.77.23" dyno= connect= service= status=503 bytes=

然后(仍然是 Heroku 日志)

And then(Still Heroku Logs)

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
Stopping process with SIGKILL
Process exited with status 137
State changed from starting to crashed
State changed from crashed to starting
Starting process with command `java $JAVA_OPTS -cp target/classes/:target/dependency/* v1.a1.server

我的 javascript 日志

My javascript logs

WebSocket connection to 'wss://Heroku-Name-39329.herokuapp.com/:5000/' failed: Establishing a tunnel via proxy server failed.

我在服务器中设置的应用程序是.

My Apps set within the server are.

String host = "";
int port = 5000;

我的档案

web: java $JAVA_OPTS -cp target/classes/:target/dependency/* v1.a1.server

推荐答案

试试这个:

String host = "0.0.0.0";
int port = System.getenv("PORT");

在 Heroku 上,您必须绑定到 0.0.0.0 并使用分配给您的应用的端口,该端口包含在 $PORT 环境变量中.

On Heroku, you must bind to 0.0.0.0 and use the port assigned to your app, which is contained in the $PORT environment variable.

从客户端,您不需要指定端口,因此只应使用 wss://Heroku-Name-39329.herokuapp.com/(而不是带有 5000 的端口).

From the client, you will not need to specify a port, so only wss://Heroku-Name-39329.herokuapp.com/ should be used (not the one with 5000).

这篇关于Heroku-Web 进程未能在启动后 90 秒内绑定到 $PORT.TooTallNate Websockets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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