Skip to content

🎵 Demo of a gRPC client and server implementation in TypeScript

License

Notifications You must be signed in to change notification settings

blokur/grpc-ts-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grpc-ts-demo

🎵 Music-themed demo of a fully typed gRPC client and server implementation in TypeScript. It implements each RPC type (unary, client streaming, server streaming and bidirectional), and uses type definitions generated with grpc_tools_node_protoc_ts.

gRPC TypeScript

The demo application takes the form of a CLI tool that allows you to manage and discuss your favourite songs. Watch demo.

Read the accompanying blog post here.

Watch Demo

Install

yarn
yarn clean
yarn build

Usage

Start the server

yarn start serve

Unary: Get a random song

yarn start get-song

Client Streaming: Add songs

yarn start add-songs

The songs you add will be persisted to the local JSON store db.json.

Server Streaming: Get chat comments on a song

yarn start get-chat --songId <id>

Bidirectional Streaming: Live chat on a song

yarn start chat

Say you set your username as mike and you choose to discuss the song with id 10. Then, the application will dump chat messages to a local file called chat-mike-10.txt. You can observe messages as they come in:

watch cat chat-mike-10.txt

Go ahead and try running multiple chat clients at once!

About

🎵 Demo of a gRPC client and server implementation in TypeScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published