Skip to content

Is the example rpcImpl in the README.md correct? #1229

@GeorgeBills

Description

@GeorgeBills

The example given is:

const rpcImpl = function(method, requestData, callback) {
  client.makeUnaryRequest(
    method.name,
    arg => arg,
    arg => arg,
    requestData,
    callback
  )
}

That gives a method call to the path "SayHello" which won't actually work against the helloworld example server - it needs to include the namespace and service in the path: "/helloworld.Greeter/SayHello".

The below seems to work for me:

const rpcImpl = function (method, requestData, callback) {
    const service = method.parent, namespace = service.parent;
    client.makeUnaryRequest(
        "/" + namespace.name + "." + service.name + "/" + method.name,
        arg => arg,
        arg => arg,
        requestData,
        callback
    )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions