Skip to content

Instantly share code, notes, and snippets.

@pragmaticlogic
Created February 24, 2014 06:35
Show Gist options
  • Select an option

  • Save pragmaticlogic/9182946 to your computer and use it in GitHub Desktop.

Select an option

Save pragmaticlogic/9182946 to your computer and use it in GitHub Desktop.
socket.io client connecting to server
if (!window.location.origin) {
window.location.origin = window.location.protocol + '//' + window.location.host;
}
var socketIo = io.connect(window.location.origin, {
port: window.location.port === '' ? '80' : window.location.port,
transports: ['websocket']
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment