https://github.com/soc221b/dependency-inversion-principle-example
https://github.com/soc221b/dependency-inversion-principle-example
chat-application dependency-inversion graphql grpc polling websocket
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/soc221b/dependency-inversion-principle-example
- Owner: soc221b
- License: mit
- Created: 2022-05-14T02:02:04.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-03T03:41:08.000Z (over 2 years ago)
- Last Synced: 2025-02-28T05:37:04.352Z (about 1 year ago)
- Topics: chat-application, dependency-inversion, graphql, grpc, polling, websocket
- Language: JavaScript
- Homepage:
- Size: 106 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dependency-inversion-principle-example
This example shows how to use the dependency-inversion principle to implement a simple chat application.

Interface:
- [`ChatAPI`](./client/src/interface.ts)
Implementation:
- [`gRPCChatAPI`](./client/src/implementations/grpc/index.ts)
> before using gRPC, make sure to
>
> 1. install `envoy`
> 2. execute `pnpm run proxy` to enable envoy proxy
- [`LongPollingChatAPI`](./client/src/implementations/long-polling/index.ts)
- [`ServerSentEventsChatAPI`](./client/src/implementations/server-sent-events/index.ts)
- [`WebSocketChatAPI`](./client/src/implementations/web-socket/index.ts)
> To switch between the different implementations, you can [comment out](./client/src/index.ts#L3) the `LongPollingChatAPI` and uncomment other implementations.
## Usage
```bash
pnpm install
pnpm run dev
```
Open http://localhost:8080/ in your browser.