Last active
October 27, 2016 14:45
-
-
Save rjriel/0c73bee533ad1bfac09412a630d4bc4d to your computer and use it in GitHub Desktop.
socket io connect with arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
host: "qlikathon.qlik.com", | |
socketPort: 3000, | |
apiPort: 8080, | |
apiId: "<id>", | |
apiSecret: "<secret>" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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