ChrisGeo
ChrisGeo

Reputation: 3907

Apache Tomcat 7 Websocket port

Is it possible to set the Websocket protocol to listen to a different port for Tomcat 7? Nothing is evident from here: https://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html

Upvotes: 0

Views: 1209

Answers (1)

cassiomolin
cassiomolin

Reputation: 130837

According to the section 1.7. Relationship to TCP and HTTP of the RFC 6455 about the WebSocket protocol:

The WebSocket Protocol is an independent TCP-based protocol. Its only relationship to HTTP is that its handshake is interpreted by HTTP servers as an Upgrade request.

By default, the WebSocket Protocol uses port 80 for regular WebSocket connections and port 443 for WebSocket connections tunneled over Transport Layer Security (TLS).

To change the HTTP/WebSocket port in Apache Tomcat, open Apache Tomcat's server.xml file and search for an entry similar to this one:

<Connector port="8080" protocol="HTTP/1.1" 
    connectionTimeout="20000" 
    redirectPort="8443" />

Replace 8080 with the desired port number, save the file and restart Apache Tomcat.

Upvotes: 3

Related Questions