Created
March 18, 2016 21:53
-
-
Save wilsonianb/d320bf05925899b5420d to your computer and use it in GitHub Desktop.
Submit websocket requests to rippled
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
// npm install ws | |
// WS_ADDRESS=127.0.0.1:6006 node ripple-websocket.js | |
var WebSocket = require('ws') | |
console.log(process.env.WS_ADDRESS) | |
var ws = new WebSocket('ws://'+process.env.WS_ADDRESS) | |
ws.on('error', function(error){ | |
console.log(error) | |
}) | |
ws.on('open', function () { | |
ws.send(JSON.stringify({ | |
"id": 1, | |
"command": "server_info" | |
})) | |
}) | |
ws.on('message', function(dataString, flags) { | |
var data = JSON.parse(dataString) | |
console.log(data) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment