Created
October 20, 2015 17:41
-
-
Save tkurki/43d2d2f526066517fb3d to your computer and use it in GitHub Desktop.
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 WebSocket = require('ws') | |
var url = "ws://" + "localhost:3000" + "/signalk/stream/v1?stream=delta"; | |
var count = 0; | |
var connection = new WebSocket(url); | |
connection.onopen = function(msg) { | |
console.log("open") | |
var sub = '{"context":"vessels.self","subscribe":[{"path":"*"}]}'; | |
connection.send(sub); | |
}; | |
connection.onerror = function(error) { | |
console.log(error) | |
}; | |
connection.onmessage = function(msg) { | |
count++; | |
}; | |
setInterval(function() { | |
console.log(count); | |
count = 0; | |
}, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment