Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kettanaito/tug-o-war
A tug-o-war game with Remix, WebSockets, and MSW.
https://github.com/kettanaito/tug-o-war
game msw mswjs remix websocket ws
Last synced: 21 days ago
JSON representation
A tug-o-war game with Remix, WebSockets, and MSW.
- Host: GitHub
- URL: https://github.com/kettanaito/tug-o-war
- Owner: kettanaito
- Created: 2024-04-04T12:09:05.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-10T20:58:26.000Z (9 months ago)
- Last Synced: 2024-10-05T06:21:12.698Z (3 months ago)
- Topics: game, msw, mswjs, remix, websocket, ws
- Language: TypeScript
- Homepage: https://tug-o-war.fly.dev
- Size: 15.6 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![Tug-o-war game in action](/public/game.png)
Tug-o-War Game
A tug-o-war game with Remix, WebSockets, and MSW. Help the stubborn dwarves settle one of the most important questions of humankind: _Tabs_ or _Spaces_? And, well, learn about the WebSocket mocking with MSW while you're at it!
👉 [**Play the live game**](https://tug-o-war.fly.dev/) 👈
> If you are reading this after EpicWeb Conf 2024, launch the game in [Admin mode](https://tug-o-war.fly.dev/?admin=true) and click "Start game" in order to play.
## Key points
- [`/server`](./server) for the production WebSocket server and the game logic.
- [`/app/mocks/handlers.ts`](./app/mocks//handlers.ts) for the WebSocket event handlers with MSW.
- [`/app/components/tug-o-war.test.tsx`](./app/components//tug-o-war.test.tsx) for integration tests with Vitest and MSW. Note that the integration tests run in a special environment ([`/test/environments/vitest-environment-node-websocket`](./test/environments//vitest-environment-node-websocket.ts) that exposes the `WebSocket` constructor globally in Node.js).
- [`/app/entry.client.tsx`](./app/entry.client.tsx) for browser integration of MSW.## Local development
```sh
npm install
npm run dev
```For build and preview:
```sh
npm run build
npm start
```## Learn more
- [**Documentation: Handling WebSocket events with MSW**](https://website-git-docs-ws-mswjs.vercel.app/docs/basics/handling-websocket-events)
- [Documentation: `ws` API](https://website-git-docs-ws-mswjs.vercel.app/docs/api/ws)
- [Submit your feedback on the new `ws` API](https://github.com/mswjs/msw/discussions/2010)