-
Notifications
You must be signed in to change notification settings - Fork 437
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
[Work in progress] Webscocket channel, Do not merge. #1084
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few notes on small nits I know you're this working n this. Going to implement this and test it tonight/tomorrow.
go/grpcweb/options.go
Outdated
@@ -126,6 +127,16 @@ func WithWebsockets(enableWebsockets bool) Option { | |||
} | |||
} | |||
|
|||
// WithWebsocketsChannel allows for handling grpc-web requests of websockets charing a single websocket between requests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: s/charing/sharing
go/grpcweb/options.go
Outdated
// WithWebsocketsChannel allows for handling grpc-web requests of websockets charing a single websocket between requests | ||
// - enabling bidirectional requests. | ||
// | ||
// The default behaviour is false, i.e. to disallow websockets channels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: 'Disabled by default.'
go/grpcwebproxy/main.go
Outdated
@@ -44,6 +44,8 @@ var ( | |||
websocketPingInterval = pflag.Duration("websocket_ping_interval", 0, "whether to use websocket keepalive pinging. Only used when using websockets. Configured interval must be >= 1s.") | |||
websocketReadLimit = pflag.Int64("websocket_read_limit", 0, "sets the maximum message read limit on the underlying websocket. The default message read limit is 32769 bytes.") | |||
|
|||
useWebsocketsChannel = pflag.Bool("use_websockets_channels", false, "whether to use a chanllel over websocket transport layer (alpha)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: s/chanllel/channel
go/grpcweb/wrapper.go
Outdated
|
||
ctx, cancelFunc := context.WithCancel(req.Context()) | ||
defer cancelFunc() | ||
NewWebsocketChannel(wsConn, w.handler, ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to show were this went :)
go/test/server_test.go
Outdated
c.Close(websocket.StatusNormalClosure, "") | ||
} | ||
|
||
func CompleteGrpc(ws *websocket.Conn, streamId uint32, ctx context.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the stream id managed? I might of missed that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client will give streamid's back and has to manage it properly.
I would use an incremental id and assume that you don't do 4g requests.
A max number of streams per channel might be useful as protection.
Add multiple strings to the header package
It seems that yesterday i forgot to commit a lot of files, i now added the typescript code but i sitl have to add the integration test. |
I really get stuck at the integration tests, i want to analyse what goes wrong, but there are no nice stack traces because of the webpack build. I think the channel never opens and that is why the tests fail but i cannot debug it which makes the further development very hard. Maybe someone else spots the error. |
Hi Boris, Sorry that you went through all this work, but I honestly don't think we can accept this large of a contribution to the code base at this stage. This code is mostly in maintenance mode and I'm not confident that we'd be able to maintain this new addition. It appears you're run into some trouble with our tests, and I'm sorry about that, but unfortunately they're one of the problems with the current code base. |
Ah to bad, atleast i learned some typescript and go on these rainy days. |
The last test run i had, it seems that it works: |
You are of course welcome to fork the project and do your own development as long as you abide by the license: https://github.com/improbable-eng/grpc-web/blob/master/LICENSE.txt |
I'm going to close this PR, since we have no intention of landing it. |
Changes
adds support to use a websocket like a managed channel/connection and reuse it for all requests.
#1081
Todo:
The code currently has been tested at this commit. More low level tests have to be added.