gRPC Application Service Client stream error


#1

Hi,

am trying to communicate with grpc server with golang. After logging I include in metadata jwt token to authenticate to the server seems correctly but the line below got always with an error 13

app, err := api.NewApplicationServiceClient(grpcConn).Get(ctx, &api.GetApplicationRequest{

Id: 2,

})

Error msg:

rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR

Also, in server side I get similar message:

http2: server connection error from 192.168.1.103:54387: connection error: PROTOCOL_ERROR

Do you know why login works fine while NewApllicationServiceClient not?


#2

@brocaar have you already seen something similar?


#3

I have not had this error myself yet. Given that you get a protocol error, are you sure your are not mixing TLS and non-TLS in your client and server?


#4

Thanks for reply.

Actually, I saw in your auth.go server side that only “authorization” metadata is expected while I was trying from client with

"Grpc-Metadata-Authorization: Bearer" : JWT

Now it works with following metadata.

"Authorization" : JWT

#5

Hello @ale16384,

I’m really interested by an example indeed as you can see from this link (gRPC api and Go), I’m trying to use grpc server with golang.

Thank you for your help.


#6

Hello,

Do you need an example to do what?

If you need to communicate with gRPC server with your client written in golang I suggest you to think about what you want to do with your client first then you can use the api list in the following page brocaar provided.


#7

Hello, thank for your answer,

In fact to start I want to use client “Go func” related to DeviceQueueItem in order to handle the data.

But the starting point is to connect to grpc server, I’m looking for any example of how to connect to the grpc server from main.go script.

I found this example but I’m looking for another to compare them.

Do you read my link in previous reply, because I 'm not sure of my understanding about grpc method and how to use it ?
Thank you so much for your help.