我正在使用一个tootallnate websockets服务器来监听来自网站的连接.
如何在heroku上建立与服务器的连接?
当我的网站尝试连接时
wss://Heroku-Name-39329.herokuapp.com/
Run Code Online (Sandbox Code Playgroud)
要么
wss://Heroku-Name-39329.herokuapp.com:5000/
Run Code Online (Sandbox Code Playgroud)
我的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=
Run Code Online (Sandbox Code Playgroud)
然后(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
Run Code Online (Sandbox Code Playgroud)
我的javascript日志
WebSocket connection to 'wss://Heroku-Name-39329.herokuapp.com/:5000/' failed: Establishing a …Run Code Online (Sandbox Code Playgroud) 我有一个使用websockets的应用程序(STOMP over SockJs),后端有Spring.应用程序在Tomcat上的localhost上工作正常(websockets)但是当我部署到Heroku或AWS Web Sockets停止工作时.我在Angular2中的websocket配置
let sockjs = new SockJS('/rest/add?jwt=' + this.authService.getToken(), {"devel":true,"debug":true}, {"transports":["websocket"]});
Run Code Online (Sandbox Code Playgroud)
我也尝试过
{"disabled_transports":["websocket"]}
Run Code Online (Sandbox Code Playgroud)
但两者都失败了.web.xml中
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<context-param>
<param-name>spring.profiles.default</param-name>
<param-value>default</param-value>
</context-param>
<servlet>
<servlet-name>ws</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/spring/ws-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>ws</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)
春天的websocket
<websocket:message-broker
application-destination-prefix="/app">
<websocket:stomp-endpoint path="/add">
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic, /queue" />
</websocket:message-broker>
Run Code Online (Sandbox Code Playgroud)
我在Heroku上的应用程序的URL,因此您可以在Web浏览器的控制台中自行检查. 链接 请看更新日志,这件事让我担心没有TransportHandler
CJyb2xlcyI6IkNVU1RPTUVSIn0.wFqNOduN-lD1-9GIRnG1X1aLJZTxtz9c6vmO7jmPPiE2017-04-06T16:23:32.439917+00:00 app[web.1]: 2017-04-06 16:2332 WARN DefaultSockJsService:239 - No TransportHandler for http://myapp-ws.herokuapp.com/rest/add/097/eyocvxic/websocket?jwt=eyJhbGciOiJI
Run Code Online (Sandbox Code Playgroud)