let socket = new io("http://localhost:7777", { query: "id=123" });
io.on("connection", socket => {
let id = socket.handshake.query.id;
console.log(id) // 123
})
module.exports = { GetFromSQL }
function GetFromSQL (pool, request, callback) {
pool.getConnection(function (err, connection) {
if (err) throw err;
connection.query(request, function (error, results, fields) {
connection.release();
if (error) throw error;
callback(results)
});
});
}
SQL.GetFromSQL(pool, request, function(results) {
// lol kek
})
socket.setEncoding("binary");
socket.on("data", data => {
var raw = new Buffer.from(data, "binary");
})