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

Enable RFC6455 (websockets) for streaming endpoints #168

Open
tmc opened this issue May 26, 2016 · 17 comments
Open

Enable RFC6455 (websockets) for streaming endpoints #168

tmc opened this issue May 26, 2016 · 17 comments

Comments

@tmc
Copy link
Collaborator

tmc commented May 26, 2016

The most reliable way to support streaming (including bidi) to web clients is RFC6455 websockets. Go has a rich implementation for websockets and grpc-gateway should enable grpc streaming endpoints with it.

@tmc tmc changed the title Enable RFC6455 for streaming endpoints Enable RFC6455 (websockets) for streaming endpoints May 26, 2016
@joeblew99
Copy link

I notices that the swaggger and openAPi group as thinking of supporting WS as part of the swagger spec.

I am currently using GRPC internally, and wrapping with the GRPC gateway, to produce a swagger spec for the outside world.
then from the swagger spec i generate Javascript API.

So, if swagger starts to offer WS, then things will be complete.

@tmc
Copy link
Collaborator Author

tmc commented May 27, 2016

preliminary work and kind of hacked up but https://github.com/tmc/grpcutils/blob/master/websocket_proxy.go is an example of wrapping grpc-gateway with a transparent websocket upgrade

@joeblew99
Copy link

@TMV
Thank you for pointing that out. This is really something i have been wanting for a while.

The code i saw referring to it was in the go-swagger repo. They are these days part of the open-api initiative. I cant remember the exact file.
But i tried that stack, and now am trying our the GRPC, GRPC-Gateway stack. I feel this is better for many reasons we dont need to go into.

Also i am building a React and React native stack on top of all this and saw your code for generating thats part of the stack at https://github.com/pwmckenna/swagger-models-to-react-proptypes.
This is awesome work, and something on my critical path.

@yugui
Copy link
Member

yugui commented May 30, 2016

I'm happy to accept streaming support with websockets, but I expect two things in the support.

  1. Concrete use cases
    • The main reason why I have not yet implemented it was that I didn't have a concrete use case.
  2. Good support in client-code generation.
    • At least, we need to be able to expect that we can have a good support in future.

@tmc
Copy link
Collaborator Author

tmc commented Jun 13, 2016

@yugui I think there's a basic argument of just fully expressing grpc's semantics to browser clients.

I have starts of basic implementations of flowtype and elmlang generators here https://github.com/tmc/grpcutils and first-class streaming support in grpc-gateway will only motivate more effort in this area.

@shaxbee
Copy link

shaxbee commented Jul 5, 2016

@tmc Your code was extremely helpful! I had slightly different requirements and couldn't use gorilla. Shameless plug: https://github.com/shaxbee/go-wsproxy ;-)

@shaxbee
Copy link

shaxbee commented Jul 5, 2016

@yugui Currently websocket wrapper is used in application I work on to handle user chat and data changes notifications.

@tmc
Copy link
Collaborator Author

tmc commented Jul 14, 2016

FWIW I separated that code: https://github.com/tmc/grpc-websocket-proxy

@yugui
Copy link
Member

yugui commented Jul 15, 2016

@tmc Wow. That's excellent.
It does not force users to depend on WebSockets but brings even more functionality.

@mikeatlas
Copy link

mikeatlas commented Jul 25, 2016

@tmc Great job on that mux wrapper. I was looking for a good example for wrapping gRPC-proxy endpoint with Throttler, but also needed WebSocket extension of streaming endpoints anyways. Double win! Would like to see this pulled into the main project, +1 @yugui

@joeblew99
Copy link

I would also like to see this pulled into the main project.
Especially with the genproto work being done.

It would solve lots of boilerplate hacks for me and probably others.

@xor-gate
Copy link

xor-gate commented Aug 1, 2018

I like the implementation of @tmc. Seems the issue has not got any updates in some time. Are you still open to pull it into the project?

@rushtehrani
Copy link

Is there a plan to pull @tmc's implementation into upstream or is there another way to support streaming for web clients that I'm not aware of?

@johanbrandhorst
Copy link
Collaborator

This hasn't been looked at in a while, but it should still be usable as a third party wrapper if you want to use websockets for bi-directional communications. Note that you can already do client side and server side streaming with vanilla grpc-gateway. What are you trying to do? Maybe join #grpc-gateway on gophers slack and we can discuss.

@d-fal
Copy link

d-fal commented May 29, 2021

Any updates on implementing @tmc's wrapper around grpc-gateway ?

@HudsonAfonso
Copy link

any updates?

@johanbrandhorst
Copy link
Collaborator

This will likely never be merged to the gateway directly, but you can still use the wrapper I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests