Skip to content

Commit c9b2e34

Browse files
Fix @fileoverview comments
1 parent 6703261 commit c9b2e34

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

javascript/net/grpc/web/generictransportinterface.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@
1616
*
1717
*/
1818
/**
19-
* @fileoverview gRPC web client Readable Stream
19+
* @fileoverview gRPC-Web generic transport interface
2020
*
21-
* This class is being returned after a gRPC streaming call has been
22-
* started. This class provides functionality for user to operates on
23-
* the stream, e.g. set onData callback, etc.
24-
*
25-
* This wraps the underlying goog.net.streams.NodeReadableStream
21+
* This class provides an abstraction for the underlying transport
22+
* implementation underneath the ClientReadableStream layer.
2623
*
2724
* @author [email protected] (Stanley Cheung)
2825
*/

javascript/net/grpc/web/interceptor.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
/**
2-
* @fileoverview grpc-web Interceptor.
2+
* @fileoverview grpc-web client interceptors.
3+
*
4+
* The type of interceptors is determined by the response type of the RPC call.
5+
* gRPC-Web has two generated clients for one service:
6+
* FooServiceClient and FooServicePromiseClient. The response type of
7+
* FooServiceClient is ClientReadableStream for BOTH unary calls and server
8+
* streaming calls, so StreamInterceptor is expected to be used for intercepting
9+
* FooServiceClient calls. The response type of PromiseClient is Promise, so use
10+
* UnaryInterceptor for PromiseClients.
311
*/
412

513
goog.module('grpc.web.Interceptor');
@@ -11,6 +19,18 @@ const Request = goog.require('grpc.web.Request');
1119
const UnaryResponse = goog.require('grpc.web.UnaryResponse');
1220

1321
/**
22+
* Interceptor for RPC calls with response type `UnaryResponse`.
23+
* An example implementation of UnaryInterceptor
24+
* <pre>
25+
* TestUnaryInterceptor.prototype.intercept = function(request, invoker) {
26+
* const newRequest = ...
27+
* return invoker(newRequest).then((response) => {
28+
* // Do something with response.getMetadata
29+
// Do something with response.getResponseMessage
30+
* return response;
31+
* });
32+
* };
33+
* </pre>
1434
* @interface
1535
*/
1636
const UnaryInterceptor = function() {};
@@ -28,6 +48,14 @@ UnaryInterceptor.prototype.intercept = function(request, invoker) {};
2848

2949

3050
/**
51+
* Interceptor for RPC calls with response type `ClientReadableStream`.
52+
*
53+
* Two steps to create a stream interceptor:
54+
* <1>Create a new subclass of ClientReadableStream that wraps around the
55+
* original stream and overrides its methods. <2>Create a new subclass of
56+
* StreamInterceptor. While implementing the
57+
* StreamInterceptor.prototype.intercept method, return the wrapped
58+
* ClientReadableStream.
3159
* @interface
3260
*/
3361
const StreamInterceptor = function() {};

0 commit comments

Comments
 (0)