rpc-codec icon indicating copy to clipboard operation
rpc-codec copied to clipboard

Support for method name mapping

Open tdterry opened this issue 8 years ago • 5 comments

I'm converting a legacy system from Python into Go, and I have some restrictions on the method names that don't work with Go's RPC layer and rpc-codec. The legacy method names are all lowercase and do not have a namespace structure "namespace.method". rpc-codec works great for me with a small hack to add "default." and capitalize the first letter of the method name. Is there an interest in making this part of rpc-codec. If desired, I could change this to a more generic "method transform" callback.

see:

https://github.com/tdterry/rpc-codec/commit/a61f13113f33560272a2063bde9cf7a881f74690

tdterry avatar Jun 06 '16 21:06 tdterry

This should be implemented in net/rpc, otherwise we'll have to implement this in each codec… Can you please ask Go developers about adding this feature into net/rpc? If they're willing to do this, in any way, then it's better to send PR to net/rpc. If they'll refuse to add this feature - then I'll accept PR with generic method transform callback.

powerman avatar Jul 20 '16 16:07 powerman

Thanks. I've submitted https://github.com/golang/go/issues/16449. We'll see if there is any interest.

tdterry avatar Jul 20 '16 17:07 tdterry

Looks like net/rpc has been frozen due to problems, and they are recommending alternatives such as http://www.grpc.io/

https://github.com/golang/go/issues/16844

dryswabbie avatar Dec 14 '16 10:12 dryswabbie

@powerman Given that net/rpc has been frozen, are you open to add this feature in powerman/rpc-codec? It makes migrating from other JSON-RPC implementation to this repo a lot easier.

libreoscar avatar Jul 09 '17 23:07 libreoscar

@libreoscar Given that net/rpc has been frozen, I think better solution should be to reimplement JSON RPC 2.0 as new package which doesn't depend on net/rpc. This helps to avoid several ugly workarounds required because of net/rpc and enable new features like method name mapping. But meanwhile we can add this feature here if anyone will send me good enough PR with tests.

powerman avatar Jul 10 '17 06:07 powerman