Skip to content

Instantly share code, notes, and snippets.

@mkozjak
Created September 19, 2016 00:07
Show Gist options
  • Save mkozjak/9af0ed0fa9a09a0b75fdc4fbc9d259c5 to your computer and use it in GitHub Desktop.
Save mkozjak/9af0ed0fa9a09a0b75fdc4fbc9d259c5 to your computer and use it in GitHub Desktop.
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