logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: websocket port in conf
Author
mwawrzyniec



Joined: 11 Oct 2018
Posts: 1

PostPosted: Thu 11 Oct '18 16:01    Post subject: websocket port in conf Reply with quote

I am attempting to get a basic javascript example to work with mosquitto. Where in the conf files does it specify what port apache uses for websockets?

Apache 2.4.29
Ubuntu
Back to top
mraddi



Joined: 27 Jun 2016
Posts: 152
Location: Schömberg, Baden-Württemberg, Germany

PostPosted: Fri 12 Oct '18 9:46    Post subject: Reply with quote

Hi,

don't know if I got your question right, so if this is not the answer you are expecting please try to do your question in other words Very Happy

Apache and Mosquitto are two different services running on two different ports. So there is no need to configure a websocket port in Apache. Your client's javascript can connect directly to the mosquitto's websocket port.
Tested and is working fine - as long as your client can reach both the Apache- and the Mosquitto-websocket-service (port 80/443 and port 1884 in my case). If your client connects to the Apache encrypted the connection to the Mosquitto has to be encrypted, too.

I've read some documentation about mod_proxy_wstunnel and it seems that Apache can act as a reverse proxy for websocket-connections, too.
In fact websockets start as a normal HTTP-connection with a "Connection: Upgrade" to become a websocket (if the destination-server supports this) - see https://en.wikipedia.org/wiki/WebSocket#Protocol_handshake
So if your Mosquitto is not directly reachable from your client using mod_proxy_wstunnel might be an interesting approach.
You can specify a vhost running on a different port containing the configuration for proxying everything to the backend-Mosquitto or maybe it is possible to put the Mosquitto-websocket-proxy-thing into a virtual directory (as they did in https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html with the paths /ws2/ and /wss2/)
I would also point to https://stackoverflow.com/questions/27526281/websockets-and-apache-proxy-how-to-configure-mod-proxy-wstunnel with the answer from "cdauth" proxying all websocket-requests to a backend-service and serving the normal http-requests with the apache itself.
Back to top


Reply to topic   Topic: websocket port in conf View previous topic :: View next topic
Post new topic   Forum Index -> Apache