Skip to content

proposal: support custom method names in net/rpc #16449

@tdterry

Description

@tdterry

I'm converting a legacy system that uses json-rpc into Go, and I have some restrictions on the method names that don't work with Go's RPC layer. The legacy method names are all lowercase and do not have a namespace structure "method_name". Go's RPC layer wants to use "Class.Method" as the method name. It would be very useful to be able to either a) provide a mapping of method names when registering a handler or b) register individual methods with a custom name.

Something like this, as taken from the net/rpc package example:

arith := new(Arith)
rpc.RegisterWithNames(arith, map[string]string{
    "mul": "Arith.Multiply",
    "div": "Arith.Divide",
})

// or

rpc.RegisterMethod("mul", Arith.Multiply)
rpc.RegisterMethod("div", Arith.Divide)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions