Skip to content

Commit

Permalink
fix example websocket client
Browse files Browse the repository at this point in the history
  • Loading branch information
tedeh committed May 23, 2021
1 parent df05513 commit 9cedfed
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/websocket/client.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const WebSocket = require('isomorphic-ws');
const jayson = require('../../');

const ws = new WebSocket('ws://localhost:12345');

const client = jayson.client.websocket(ws);
const client = jayson.client.websocket({
url: 'ws://localhost:12345',
});

client.request('add', [1,2,3,4], function (err, result) {
console.log(err, result);
client.ws.on('open', function () {
client.request('add', [1,2,3,4], function (err, result) {
console.log(err, result);
client.ws.close();
});
});

0 comments on commit 9cedfed

Please sign in to comment.