https://github.com/joaorafa19/group-webchat-api
https://github.com/joaorafa19/group-webchat-api
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/joaorafa19/group-webchat-api
- Owner: JoaoRafa19
- Created: 2023-08-28T19:33:27.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-15T18:47:41.000Z (7 months ago)
- Last Synced: 2024-12-28T11:43:21.422Z (6 months ago)
- Language: Go
- Size: 22 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Websocket chatroom api
## How to use
### 1. Install dependencies
```bash
go mod tidy
```### 2. Run server
```bash
go run main.go
```### 3. Create a room
```bash
curl -X GET http://localhost:8080/'
``````json
{
"created_room": "9ae71801-abbb-4759-92fb-88714900811b"
}
```### 3. Open client
Use a websocket client to connect to `ws://localhost:8080/ws/{room_id}` and send a message to the server. The server will broadcast the message to all connected clients.
## Database
Create mongo database
```bash
docker run -d --name mongodb -p 27017:27017 mongo
```