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
var http = require('http'); | |
var MongoClient = require('mongodb').MongoClient; | |
var server = require('websocket').server; | |
startMongoDBConnection(); | |
function startMongoDBConnection(){ | |
MongoClient.connect('mongodb://localhost:27017/sparta', function(err, db) { | |
startWebSocketServer(db); | |
}); |
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
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<div style="margin: 20px;display: block;"> | |
<canvas style="width: 600px; height: 300px" id="chart"></canvas> | |
</div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js"></script> | |
<script> | |
var ws = new WebSocket('ws://127.0.0.1:8008/'); |