Created
August 17, 2017 15:21
-
-
Save nutrino/f06d1dc3a145e8461f06ebb00ff28517 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
| const w3cws = require('websocket').w3cwebsocket; | |
| const wampy = require('wampy'); | |
| const ws = new wampy.Wampy('ws://127.0.0.1:8080/ws', { autoReconnect: false, ws: w3cws, realm: 'realm1' }); | |
| //exports.ws = ws; | |
| //const wampy = require('./wampy_client.js'); | |
| //const ws = wampy.ws; | |
| console.log('start'); | |
| ws.call('com.math.slowsquare', 3, { | |
| onSuccess: function (result) { | |
| console.log('SlowSquare: ' + JSON.stringify(result.argsList[0])); | |
| }, | |
| onError: function (err) { | |
| console.log('RPC call failed with error ' + err.error); | |
| } | |
| }); | |
| ws.call('tupleTestAsync', [4,5,6], { | |
| onSuccess: function (result) { | |
| console.log('TupleTestAsync: ' + JSON.stringify(result.argsList[0])); | |
| }, | |
| onError: function (err) { | |
| console.log('RPC call failed with error ' + err.error); | |
| } | |
| }); | |
| ws.call('dictTestAsync', [{'a': 2}], { | |
| onSuccess: function (result) { | |
| console.log('DictTestAsync: ' + JSON.stringify(result.argsList[0])); | |
| }, | |
| onError: function (err) { | |
| console.log('RPC call failed with error ' + err.error); | |
| } | |
| }); | |
| ws.call('com.math.square', 3, { | |
| onSuccess: function (result) { | |
| console.log('QuickSquare: ' + JSON.stringify(result.argsList[0])); | |
| }, | |
| onError: function (err) { | |
| console.log('RPC call failed with error ' + err.error); | |
| } | |
| }); | |
| ws.call('tupleTest', [4,5,6], { | |
| onSuccess: function (result) { | |
| console.log('TupleTest: ' + JSON.stringify(result.argsList[0])); | |
| }, | |
| onError: function (err) { | |
| console.log('RPC call failed with error ' + err.error); | |
| } | |
| }); | |
| setTimeout(function() { | |
| console.log('done'); | |
| }, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment