Skip to content

Instantly share code, notes, and snippets.

@rjriel
Last active October 27, 2016 14:45
Show Gist options
  • Save rjriel/0c73bee533ad1bfac09412a630d4bc4d to your computer and use it in GitHub Desktop.
Save rjriel/0c73bee533ad1bfac09412a630d4bc4d to your computer and use it in GitHub Desktop.
socket io connect with arguments
module.exports = {
host: "qlikathon.qlik.com",
socketPort: 3000,
apiPort: 8080,
apiId: "<id>",
apiSecret: "<secret>"
}
const io = require("socket.io-client")
const config = require("./config")
console.log("Welcome to the Qritter Wars Client")
const socketArguments = `apiId=${config.apiId}&apiSecret=${config.apiSecret}`
let socket = io.connect(`http://${config.host}:${config.socketPort}`, { query: socketArguments})
socket.on('connect', function(data) {
console.log('connected')
})
socket.on('invalid', (error) => {
console.log('error', error)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment