Created
September 19, 2016 00:07
-
-
Save mkozjak/9af0ed0fa9a09a0b75fdc4fbc9d259c5 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 ws = require("ws") | |
var c = new ws("ws://localhost:3333/rpc/1.0") | |
c.on("open", function() { | |
console.log("opened") | |
c.send(JSON.stringify({ | |
jsonrpc: "2.0", | |
method: "authorize", | |
params: { uid: "scr01" }, | |
id: 1 | |
})) | |
}) | |
c.on("message", function(message) { | |
console.log(message) | |
}) | |
c.on("error", function(error) { | |
console.log("error,", error) | |
}) | |
c.on("closed", function() { | |
console.log("closed") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment