UNPKG

544 BJavaScriptView Raw
1/* global notdefined */
2var rpcClient = require('socket.io-rpc-client')
3
4var rpc = rpcClient('http://localhost:8032')
5
6rpc.expose({
7 fnOnClient: function () {
8 console.log('called client method')
9 return 42
10 },
11 asyncOnClient: function () {
12 return new Promise(function (resolve, reject) {
13 setTimeout(function () {
14 resolve('resolved after 40ms')
15 }, 40)
16 })
17 },
18 erroringMethod: function () {
19 notdefined.error.will.propagate
20 },
21 callTextTestOnServer: function () {
22 return rpc('textTest')()
23 }
24})