Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create stream #20

Open
kchrome opened this issue Nov 15, 2021 · 0 comments
Open

Failed to create stream #20

kchrome opened this issue Nov 15, 2021 · 0 comments

Comments

@kchrome
Copy link

kchrome commented Nov 15, 2021

Following the tutorial I try to run my own service and get an error. What could I have done wrong?

{ok, Connection} = grpc_client:connect(tcp, "localhost", 10000).
{ok, Stream} = grpc_client:new_stream(Connection, 'Send', 'SendMessage', speak).

** exception error: no match of right hand side value {error,<<"failed to create stream">>}

speak.proto

syntax = "proto3";

  option java_multiple_files = true;

package Send;

service Send {

rpc SendMessage(Message) returns (readReciept) {}

}

message Message {

string messageContent = 1;

}

message readReciept {

string reciept = 1;

}

speak_client.erl

-module(speak_client).

%% this file was generated by grpc

-export(['SendMessage'/3]).

-type 'Message'() ::
    #{messageContent => string()}.

-type readReciept() ::
    #{reciept => string()}.

-export_type(['Message'/0,
              readReciept/0]).

-spec decoder() -> module().
%% The module (generated by gpb) used to encode and decode protobuf
%% messages.
decoder() -> speak.

%% RPCs for service 'Send'

-spec 'SendMessage'(
        Connection::grpc_client:connection(),
        Message::'Message'(),
        Options::[grpc_client:stream_option() |
                  {timeout, timeout()}]) ->
        grpc_client:unary_response(readReciept()).
%% This is a unary RPC
'SendMessage'(Connection, Message, Options) ->
    grpc_client:unary(Connection, Message,
                      'Send', 'SendMessage',
                       decoder(), Options).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant