Skip to content

Instantly share code, notes, and snippets.

View AlphaT7's full-sized avatar

Jamison Winters AlphaT7

View GitHub Profile
@AlphaT7
AlphaT7 / client.js
Last active August 11, 2017 21:22 — forked from sahat/client.js
Calculate client-server latency using socket.io
var socket = io.connect('http://localhost');
var startTime;
setInterval(function() {
startTime = Date.now();
socket.emit('client2server');
}, 2000);
socket.on('server2client', function() {
latency = Date.now() - startTime;
<html>
<head>
<title>Simple Line Graph using SVG and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;