您的位置:首页技术文章
文章详情页

在启动后的90秒内,Heroku- Web进程未能绑定到$ PORT。TooTallNate Websockets

浏览:49日期:2024-05-02 08:58:50
如何解决在启动后的90秒内,Heroku- Web进程未能绑定到$ PORT。TooTallNate Websockets?

尝试使用此:

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

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

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

解决方法

我正在使用tootallnate websockets服务器来侦听来自网站的连接。

如何连接到Heroku上的服务器?

当我的网站尝试连接时

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

要么

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

我的heroku日志输出。

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 Logs)

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

我的JavaScript日志

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

我的应用程序在服务器内设置。

String host = '';int port = 5000;

我的档案

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

标签: web