mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
docs+lnrpc: enable bi-directional WebSockets
The grpc-gateway library that is used to transform REST calls into gRPC uses a different method for reading a request body stream depending on whether the RPC is a request-streaming one or not. We can't really find out what kind of RPC the user is calling at runtime, so we add a new parameter to the proxy that lists all request-streaming RPC calls. In any case the client _has_ to send one request message initially to kick off the request processing. Normally this can just be an empty message. This can lead to problems if that empty message is not expected by the gRPC server. But for the currently existing two client-streaming RPCs this will only trigger a warning (HTLC interceptor) or be ignored (channel acceptor).
This commit is contained in:
4
lnd.go
4
lnd.go
@@ -1265,7 +1265,9 @@ func startRestProxy(cfg *Config, rpcServer *rpcServer, restDialOpts []grpc.DialO
|
||||
}
|
||||
|
||||
// Wrap the default grpc-gateway handler with the WebSocket handler.
|
||||
restHandler := lnrpc.NewWebSocketProxy(mux, rpcsLog)
|
||||
restHandler := lnrpc.NewWebSocketProxy(
|
||||
mux, rpcsLog, lnrpc.LndClientStreamingURIs,
|
||||
)
|
||||
|
||||
// Use a WaitGroup so we can be sure the instructions on how to input the
|
||||
// password is the last thing to be printed to the console.
|
||||
|
Reference in New Issue
Block a user