Skip to content

Instantly share code, notes, and snippets.

@Waltari10
Created July 13, 2015 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Waltari10/f360bde20da7563217f1 to your computer and use it in GitHub Desktop.
Save Waltari10/f360bde20da7563217f1 to your computer and use it in GitHub Desktop.
"use strict";
var WebSocketServer = require('ws').Server
, wss = new WebSocketServer({ port: 8080 });
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'password',
database : 'test',
debug : true
});
console.log(connection.query);
wss.on('connection', function connection(ws) {
ws.on('message', function incoming(textChunk) {
console.log(connection);
console.log(connection.query);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment