tmc / grpc-websocket-proxy

A proxy to transparently upgrade grpc-gateway streaming endpoints to use websockets
MIT License
553 stars 72 forks source link

Unable to read from socket #16

Closed steotia closed 4 years ago

steotia commented 4 years ago

For the WebSocket example GET on /echo I am unable to read anything from the socket, only able to write back. Reading simply returns an error EOF, when trying to RecvMsg in the gRPC server.

steotia commented 4 years ago

Got it. For bidi comms, the GET /echo has to be modified to become POST /echo. Can be achieved via

var wsopts []wsproxy.Option
wsopts = append(wsopts, wsproxy.WithMethodParamOverride("POST"))
http.ListenAndServe(*httpAddr, wsproxy.WebsocketProxy(mux, wsopts...))

This is not very obvious

jacobnosal commented 4 years ago

@steotia Were you able to connect to the server using the browser web socket client or another? I receive a 405 Method Not Allowed, but haven't investigated much further.