mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
embed: support websocket for bi-directional streams
This commit is contained in:
parent
867e3da0c4
commit
37eabd770e
@ -37,6 +37,7 @@ import (
|
||||
|
||||
gw "github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/soheilhy/cmux"
|
||||
"github.com/tmc/grpc-websocket-proxy/wsproxy"
|
||||
"golang.org/x/net/trace"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
@ -214,7 +215,19 @@ func (sctx *serveCtx) createMux(gwmux *gw.ServeMux, handler http.Handler) *http.
|
||||
httpmux.Handle(path, h)
|
||||
}
|
||||
|
||||
httpmux.Handle("/v3alpha/", gwmux)
|
||||
httpmux.Handle(
|
||||
"/v3alpha/",
|
||||
wsproxy.WebsocketProxy(
|
||||
gwmux,
|
||||
wsproxy.WithRequestMutator(
|
||||
// Default to the POST method for streams
|
||||
func(incoming *http.Request, outgoing *http.Request) *http.Request {
|
||||
outgoing.Method = "POST"
|
||||
return outgoing
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
if handler != nil {
|
||||
httpmux.Handle("/", handler)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user