emailjs/emailjs-tcp-socket

Enable wsShim socket.io to connect to different host than origin

mauron85 opened this issue · 2 comments

Currently socket.io connection is established to the same host as script origin. It would be nice, if socket.io host can be configurable.

My bad. It is actually possible via ws option. So maybe just adding mention in docs.

it's in there:

A note on WebSockets: Run the websocket proxy (socket.io + express) to use TCPSocket straight from the browser.

WebSocket shim adds a new configuration object ws to TCPSocket.open

url is the url for the WebSocket proxy server (defaults to '/')
options are Socket.io options

var socket = TCPSocket.open('127.0.0.1', 9000, { ... ws: { url: 'http://localhost:8889', options: { upgrade: false } } });

To run WebSocket integration tests that connect to imap.gmail.com:993 run

NODE_ENV=integration node ws-proxy/server.js