Created
July 13, 2016 09:12
-
-
Save tinybike/42451d0c8501f493e07bfa1efe6c9f1c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env node | |
| var W3CWebSocket = require("websocket").w3cwebsocket; | |
| var websocket = new W3CWebSocket("ws://127.0.0.1:8546"); | |
| websocket.onerror = function () { | |
| console.log("websocket error :("); | |
| }; | |
| websocket.onclose = function () { | |
| console.log("websocket closed"); | |
| }; | |
| websocket.onmessage = function (msg) { | |
| console.log("websocket message:", msg.data); | |
| }; | |
| websocket.onopen = function () { | |
| console.log("websocket open"); | |
| websocket.send(JSON.stringify({"id":1,"jsonrpc":"2.0","method":"eth_gasPrice","params":[]})); | |
| websocket.send(JSON.stringify({"id":2,"jsonrpc":"2.0","method":"eth_coinbase","params":[]})); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment