[SOLVED]socket.io - websocket custom port

General Discussion
  • #1

    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.

    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

  • GNU/Linux

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

  • #3

    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 🙂

Suggested Topics

| | | |