[SOLVED]socket.io - websocket custom port


  • Translator

    Hi guys!

    A question appeared regarding the websockets.
    When I deployed app on server - I permanently get 400 Bad request on websocket connection request.
    It uses port :80 by default. However 'polling' works well.
    ws://mysite.com/socket.io/?EIO=3&transport=websocket&sid=Bmp017bUrGU9UVQTAAAB

    Is it possible to some how force websockets to use another port than '80'?
    e.g. ws://mysite.com:8080/socket.io/?EIO=3&transport=websocket&sid=Bmp017bUrGU9UVQTAAAB


  • Admin

    Just a note -- if you have HTTPS active, socket.io will use port 443 instead, which has better compatibility.


  • Translator

    Thank you for your note, @julian
    I acctually found what I were need.
    Adding an appropriate string to config.json - solved my problem.

    "socket.io": {
    	"address": "http://myforum.com:8000"
    }
    

    Thus websocket will use port 8000 on establishing the connection.
    One of openshift's bottleneck, that held me up.
    Done :)


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.