question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot make RPC call through WebSocket transport

See original GitHub issue

I installed the version 6.5 and use this in the electron-quick-start sample project. While I cannot make any RPC call as the OutgoingRequest.isMethodCalled is always true.

const JSONRPC  = require("jsonrpc-bidirectional");
const WebSocket = require("ws");

async function loadThroughJsonRPC() {
    const defaultAPIEndPoint = 'ws://localhost:8080'
    const ws = new WebSocket(defaultAPIEndPoint);
    await new Promise((resolve, reject) => {
      ws.on("open", resolve);
      ws.on("error", reject);
    });

    const rpcClient = new JSONRPC.Client(defaultAPIEndPoint);
    const webSocketTransport = new JSONRPC.Plugins.Client.WebSocketTransport(ws);
    rpcClient.addPlugin(webSocketTransport);

    var request = {
            Name:'AccountService',
            MethodName:'GetAccountCount',
            Parameters:["1"]
          };
    await rpcClient.rpc("CallService", [request]);
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yingfangducommented, May 1, 2018

At last, I change to use react-scripts@2.0.0-next.66cc7a90 solves my issue.

0reactions
yingfangducommented, May 1, 2018

OK, I find another issue with me, maybe should I open it as another issue?

I am using this package in a react app. and when i build it with react-scripts build && npm run release command, it gets build errors like this:

E:\Repos\BAE\src\electron\htmlui> npm run build

bae-electron@0.1.0 build E:\Repos\BAE\src\electron\htmlui react-scripts build && npm run release

Creating an optimized production build…Failed to compile.

Failed to minify the code from this file:

    ./node_modules/jsonrpc-bidirectional/src/Exception.js:10

Read more here: http://bit.ly/2tRViJ9 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! bae-electron@0.1.0 build: react-scripts build && npm run release npm ERR! Exit status 1npm ERR! npm ERR! Failed at the bae-electron@0.1.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\yingfand\AppData\Roaming\npm-cache_logs\2018-05-01T21_59_10_077Z-debug.log

Read more comments on GitHub >

github_iconTop Results From Across the Web

Notifications on a websocket transport trigger a timeout after ...
While the notification is formatted and sent to the web-socket as expected , it triggers a timeout after 5000ms since a response is...
Read more >
rpc-websocket - npm
RPC WebSocket is a wrapper for standard websockets that adds support for message types, RPC, and for before/after send/receive events.
Read more >
Android JSON-RPC tunneled in websocket - Stack Overflow
To "tunnel" JSON-RPC over that, for example, you could sub-class the JSONRPCClient class in android-json-rpc (overriding the doJSONRequest ...
Read more >
Use JSON-RPC over HTTP, WebSocket, and IPC
To make RPC requests over WebSocket, you can use wscat , a Node.js based command-line tool. First connect to the WebSocket server using...
Read more >
May I send request from Server to Client over WebSocket ...
I implement client-server RPC communication (client is not Web browser) and want to use JSON-RPC 2.0 spec over WebSocket. But what I don't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found