client —
var socket = io( { transports : ['polling'], path : '/mysocket' });
server–
io = require('socket.io')(server,{ path : '/mysocket' });
nginx —
location /socket/ { proxy_pass http://example.com:3005 }
https://example.com is running on two ports 3003 & 3005 all endpoints are connected to 3003 and my end point is connected to 3005 where my socket connections will be done,but the the socket is not connecting to 3005 instead it is connecting to 3003.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
it was nginx where i was missing i need to add
location /socket/ { proxy_http_version 1.1 proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://example.com:3005; }
this solved my issue
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0