{"url":"https://api.github.com/gists/1557990","forks_url":"https://api.github.com/gists/1557990/forks","commits_url":"https://api.github.com/gists/1557990/commits","id":"1557990","node_id":"MDQ6R2lzdDE1NTc5OTA=","git_pull_url":"https://gist.github.com/1557990.git","git_push_url":"https://gist.github.com/1557990.git","html_url":"https://gist.github.com/mbostock/1557990","files":{"sample-client.js":{"filename":"sample-client.js","type":"text/javascript","language":"JavaScript","raw_url":"https://gist.githubusercontent.com/mbostock/1557990/raw/cd2322b149c7804edeb65696bc498ee6d9cfbb03/sample-client.js","size":577,"truncated":false,"content":"var websocket = require(\"websocket\");\n\nvar client = new websocket.client();\n\nclient.on(\"connect\", function(connection) {\n  var remaining = 762; // based on start, stop, and step\n\n  connection.on(\"message\", function(message) {\n    if (message.type === \"utf8\") {\n      if (!--remaining) connection.close();\n      console.log(message.utf8Data);\n    }\n  });\n\n  connection.sendUTF(JSON.stringify({\n    expression: \"sum(request)\",\n    start: \"2011-09-10T12:37:12Z\",\n    stop: \"2011-09-13T04:00:02Z\",\n    step: 300000\n  }));\n});\n\nclient.connect(\"ws://localhost:1081/1.0/metric/get\");\n","encoding":"utf-8"}},"public":true,"created_at":"2012-01-04T01:40:10Z","updated_at":"2015-09-29T06:08:03Z","description":"Cube Metrics Client (Node.js + WebSockets)","comments":0,"user":null,"comments_enabled":true,"comments_url":"https://api.github.com/gists/1557990/comments","owner":{"login":"mbostock","id":230541,"node_id":"MDQ6VXNlcjIzMDU0MQ==","avatar_url":"https://avatars.githubusercontent.com/u/230541?v=4","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","user_view_type":"public","site_admin":false},"forks":[],"history":[{"user":{"login":"mbostock","id":230541,"node_id":"MDQ6VXNlcjIzMDU0MQ==","avatar_url":"https://avatars.githubusercontent.com/u/230541?v=4","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","user_view_type":"public","site_admin":false},"version":"ecb2691211fa95e6de17eab70a34943e3062a58c","committed_at":"2012-01-04T01:40:10Z","change_status":{"total":23,"additions":23,"deletions":0},"url":"https://api.github.com/gists/1557990/ecb2691211fa95e6de17eab70a34943e3062a58c"}],"truncated":false}