client side http2 support?
See original GitHub issueHi~ great work!
Now i want to use grpc-web
as the client side and grpc-java
as the server side to make the rpc call,
but after request code called, there were some error:
proto
syntax = "proto3";
option java_package = "com.xxx.xxxxxx.proto_out";
// The stream service definition.
service PlayStream {
// Sends a greeting
rpc PlayStreamGetInfo (StreamReq) returns (StreamAck) {}
}
// The request message containing the user's name.
message StreamReq {
uint32 camera_id = 1;
}
// The response message containing the greetings
message StreamAck {
uint32 camera_id = 1;
string play_url = 2;
}
request (http)
let test_obj = new PlayStreamClient('http://localhost:9898', null, null);
let request = new StreamReq();
request.setCameraId(1);
test_obj.playStreamGetInfo(request, {}, function(err, response){
console.log(response);
});
error
io.netty.handler.codec.http2.Http2Exception: Unexpected HTTP/1.x request: OPTIONS /PlayStream/PlayStreamGetInfo
at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:85)
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.readClientPrefaceString(Http2ConnectionHandler.java:314)
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:251)
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:450)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
and then i change the request to https:
let test_obj = new PlayStreamClient('https://localhost:9898', null, null);
the errors:
2019-01-10 17:32:20.562 INFO io.grpc.netty.NettyServerTransport.connections - Transport failed
io.netty.handler.codec.http2.Http2Exception: HTTP/2 client preface string missing or corrupt. Hex dump for received bytes: 1603010200010001fc030328c6f84d3168505fcbc5ab169f
at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:85)
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.readClientPrefaceString(Http2ConnectionHandler.java:318)
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:251)
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:450)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
How should i to solve this ? and i don’t want any proxy (envoy or nginx), just make directly call… Need u help, thx.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Client-Side HTTP/2 (Preview) - Documentation - Akka
There are three mechanisms for a client to establish an HTTP/2 connection. Akka HTTP supports: HTTP/2 over TLS; HTTP/2 over a plain TCP...
Read more >HTTP/2 Frequently Asked Questions
Will I need TCP_NODELAY for my HTTP/2 connections? Yes, probably. Even for a client-side implementation that only downloads a lot of data using...
Read more >Introduction to HTTP/2 - web.dev
HTTP/2 (or h2) is a binary protocol that brings push, multiplexing streams and frame control to the web.
Read more >HTTP/2 - Wikipedia
HTTP/2 (originally named HTTP/2.0) is a major revision of the HTTP network protocol used by ... Server-side supportEdit. Main article: Comparison of web...
Read more >How to tell from server side if client supports http/2
Test if the client (user browser) supports http/2 pushes, some how detect when the server sends a push, does the client able to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@xzzh999 Armeria gRPC server can serve gRPC-over-HTTP/1.1 and HTTP/2
Can you document a workaround?