Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tinkerbaj/chat-websocket-gin
Example of using gorilla websocket with gin (chat with rooms)
https://github.com/tinkerbaj/chat-websocket-gin
chat chatroom gin gin-framework gin-gonic go golang real-time realtime websocket websockets
Last synced: 3 months ago
JSON representation
Example of using gorilla websocket with gin (chat with rooms)
- Host: GitHub
- URL: https://github.com/tinkerbaj/chat-websocket-gin
- Owner: tinkerbaj
- License: mit
- Created: 2022-07-01T17:25:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-21T06:16:30.000Z (over 1 year ago)
- Last Synced: 2024-10-01T01:02:05.230Z (4 months ago)
- Topics: chat, chatroom, gin, gin-framework, gin-gonic, go, golang, real-time, realtime, websocket, websockets
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 34
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# chat-websocket-gin
Example of using gorilla websocket with gin (chat with rooms)* Clone repo
* Enter in console "go mod tidy" to fetch all packages project need
* Enter "go run main.go" to start serverWebsocket route will be ws://localhost:8080/ws/ + any name
for example: ws://localhost:8080/ws/room1
You can use WebSocket King Client Chrome extension to test it
If you use room1 id for example like ws://localhost:8080/ws/room1
you can use this JSON
```
{
"type": "message",
"sender": "user1",
"recipient": "user2",
"content": "How are you",
"id": "room1"
}
```
run 2 clients on the same URL ws://localhost:8080/ws/room1 and you can use the same JSON just important is to send on the same id in our case room1