jquery - Javascript Websocket to listen on port 80 -
i have web server deployed in port 80
websocket running in javascript.
var wsurl = ws://localhost:80/ws" wsconn = new websocket(wsurl);
but keep getting error:
websocket connection 'ws://localhost/ws' failed: error in connection establishment: net::err_connection_refused
i had no problem when run locally port other 80
in production need use port 80
, keep getting error.
is there anyway can make websocket
work port 80
?
using window.location.hostname
clear url discrepancies have while in production. using localhost
in url result in ws requests user's local machines opposed production server. hence connection refusal.
note method meant when client directly served same websocket server, if servers ever different need way exact url of websocket server. --most type of redirect/forward/proxy backend (serving frontend) websocket server.
Comments
Post a Comment