Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
grpc-node-server-interceptors
Advanced tools
This package provides an interface for gRPC Servers from `@grpc/grpc-js` to be created with interceptors. Allows for intercepting incoming requests from gRPC clients as well as intercepting outgoing responses from the server.
This package provides an interface for gRPC Servers from @grpc/grpc-js
to be created with interceptors. Allows for intercepting incoming requests from gRPC clients as well as intercepting outgoing responses from the server.
npm install grpc-node-server-interceptors
yarn add grpc-node-server-interceptors
This example shows how to intercept incoming gRPC client requests on your gRPC server:
import { status as GrpcStatus } from '@grpc/grpc-js`;
import GrpcServerWithInterceptors, { ServerInterceptor, ServerInterceptingCall } from 'grpc-node-server-interceptors';
const interceptors: ServerInterceptor<RequestType, RequestResponse>[] = [
(call, nextCall) => {
return new ServerInterceptingCall(nextCall(call), {
// This is called on every incoming client request before sent to the original handler
onReceiveMessage: (message, next) => {
// Continue unto the next interceptor
next(message);
},
// This is called on every outgoing server response before it is sent to the client
onSendMessage: (response, next) => {
if (response.status !== GrpcStatus.OK) {
log.error(response.status);
}
next(response);
},
});
}
]
const server = new GrpcServerWithInterceptors({
...channelOptions,
// List of global interceptors. These will be applied to all services added to the server through `addService`.
interceptors,
});
// Consume the new server the same way you would with `grpc.Server`
server.addService(serviceDefinition, handlers);
server.bindAsync(...);
FAQs
This package provides an interface for gRPC Servers from `@grpc/grpc-js` to be created with interceptors. Allows for intercepting incoming requests from gRPC clients as well as intercepting outgoing responses from the server.
The npm package grpc-node-server-interceptors receives a total of 12 weekly downloads. As such, grpc-node-server-interceptors popularity was classified as not popular.
We found that grpc-node-server-interceptors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.