``` redis gRPC proxy
USAGE: redis-grpc [OPTIONS]
FLAGS: --help Print help information -V, --version Print version information
OPTIONS:
-h, --host
redis-grpc -h redis://localhost:10400 -p 50051
Supports keys
get
set
subscribe
channel
and arbitrary command (response casted to string)
yarn install redis-grpc
or npm install redis-grpc
Basic Example
```typescript /// JavaScript / TypeScript import { RedisGrpcPromiseClient } from 'redis-grpc/gen-js/redisgrpcgrpcwebpb'; import { KeysRequest, SetRequest } from 'redis-grpc/gen-js/redisgrpcpb';
const perform_set = () => { const client = new RedisGrpcPromiseClient("http://localhost:50051");
/// support TypeScript let req = new SetRequest();
req.setKey("key") req.setValue("value");
client.set(req) .then(resp => console.log(resp.getResult())) .catch(console.error) } ```
```typescript /// Subscribe channels const subrequest = new SubscribeRequest(); subrequest.setChannelsList(["channel:1", "channel:2"]); const stream = client.subscribe(sub_request); stream.on('data', (data: SubscribeResponse) => { console.log({ message: data.getMessage(), channel: data.getChannel(), }) })
/// Publish channel const pubrequest = new PublishRequest(); pubrequest.setChannel("channel:1") await client.publish(pub_request); ```
This repository is licensed under the "MIT" license. See LICENSE.