Skip to content

Commit ad2bff0

Browse files
committed
docs: update README for Matching Service with Postman & WebSocket instructions
1 parent dde0cf9 commit ad2bff0

File tree

1 file changed

+51
-5
lines changed

1 file changed

+51
-5
lines changed
Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,59 @@
1-
Matching Service
2-
Overview
3-
The Matching Service is responsible for pairing users in PeerPrep based on selected topic, difficulty, and programming language. It manages user queues, handles match creation, and communicates with other services (User Service, Question Service, Collaboration Service).
1+
# Matching Service
42

5-
This service is built using FastAPI and is designed to be containerised using Docker.
3+
## Overview
64

7-
Features
5+
The **Matching Service** is responsible for pairing users in PeerPrep based on selected topic, difficulty, and programming language. It manages user queues, handles match creation, and communicates with other services such as:
6+
7+
- **User Service**
8+
- **Question Service**
9+
- **Collaboration Service**
10+
11+
This service is built using **FastAPI** and is designed to be **containerised using Docker**.
12+
13+
---
14+
15+
## Features
816

917
- Join a match queue for a specific topic, difficulty, and programming language
1018
- Automatic peer matching from the queue
1119
- Cancel a queue request
1220
- Integration points for collaboration sessions
1321
- Health check endpoint for service monitoring
22+
23+
---
24+
25+
## API Testing with Postman
26+
27+
A **Postman collection** is provided to test the Matching Service:
28+
29+
1. Open Postman -> Import -> File -> `postman/PeerPrep.postman_collection.json`
30+
2. The collection includes:
31+
- Join queue (`/match/request`)
32+
- Cancel queue (`/match/cancel`)
33+
3. Update environment variables if needed (e.g., `url`)
34+
35+
---
36+
37+
## WebSocket Testing
38+
39+
To test real-time events such as match found or timeout:
40+
41+
1. Open Postman -> New -> WebSocket Request
42+
2. URL: `ws://localhost:8000/match/ws/{{user_id}}`
43+
3. Replace `{{user_id}}` with your test user
44+
4. Click **Connect**
45+
5. To simulate events:
46+
- POST `/match/request` from **user 1** and **user 2** to trigger `match.found`
47+
- POST `/match/request` to trigger `match.timeout` if no peer is found within 60 seconds
48+
49+
---
50+
51+
## Running the service
52+
53+
### Using Make
54+
55+
From the `matching-service` folder, run:
56+
57+
```bash
58+
make run
59+
```

0 commit comments

Comments
 (0)