GrainGenes / jbconnect

JBConnect, an optional server-side component of JBrowse
http://jbconnect.readthedocs.io
Other
0 stars 0 forks source link

sails.io.js resolve cross origin and proxy #8

Open enuggetry opened 3 years ago

enuggetry commented 3 years ago

https://serverfault.com/questions/829100/socket-io-with-sails-js-node-js-and-nginx-on-ssl-bad-gateway

enuggetry commented 3 years ago

https://github.com/balderdashy/sails/issues/6494

See balderdashy/sails.io.js#66, but it is not yet merged into 0.11.7.

    io.sails.url = "https://graingenes.org"
    io.sails.path = "/jbconnect/socket.io"
    io.sails.useCORSRouteToGetCookie = false
enuggetry commented 3 years ago

https://graingenes.org/jbconnect/socket.io/?__sails_io_sdk_version=0.13.8&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=polling&t=NmOrq6J

{
"code": 0,
"message": "Transport unknown"
}
enuggetry commented 3 years ago

Client Config:

  <script type="text/javascript" src="https://graingenes.org/jbconnect/js/dependencies/sails.io.js"></script>
  <script type="text/javascript">
    io.sails.url = "https://graingenes.org"
    io.sails.path = "/jbconnect/socket.io"
    io.sails.useCORSRouteToGetCookie = false
    io.sails.transports = ['websocket','polling']
  </script>

https://graingenes.org/jbconnect/socket.io/?__sails_io_sdk_version=0.13.8&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=websocket&t=NmOrq6J

{
   "code": 3,
   "message": "Bad request"
}
enuggetry commented 3 years ago

proxy_wstunnel module for apache:
https://stackoverflow.com/questions/17334319/setting-up-a-websocket-on-apache

sudo apache2ctl -M to list modules  
enuggetry commented 3 years ago

Client seems to be connecting to server in this combination: https://graingenes.org/jbctest/index-test.html

sockets.js

transports: [ 'polling','websocket' ],

client side:

  <script type="text/javascript" src="https://graingenes.org/jbconnect/js/dependencies/sails.io.js"></script>
  <script type="text/javascript">
    io.sails.url = "https://graingenes.org"
    io.sails.path = "/jbconnect/socket.io"
    io.sails.useCORSRouteToGetCookie = false
    //io.sails.transports = ['polling','websocket']
    io.sails.transports = ['polling']
  </script>