module
Version:
v0.0.0-...-117d3b4
Opens a new window with list of versions in this module.
Published: Mar 11, 2025
License: GPL-3.0
Opens a new window with license information.
README
¶
WowiwesO
Work With Web Socket (WoWiWeSo). hahaha
A Go-based real-time chat application that demonstrates two different approaches to real-time communication: WebSocket and Server-Sent Events (SSE).
Screenshots
WebSocket Chat
Real-time chat with user presence tracking
SSE Chat
Server-Sent Events based chat interface
Features
- Multiple Chat Implementations:
- WebSocket Chat: Full-duplex communication with user presence
- SSE Chat: Server-sent events for real-time updates
- User Interface:
- Real-time message updates
- User presence indicators
Project Structure
.
├── cmd/
│ └── web/ # Application entry point
│ ├── main.go # Main application setup
│ └── routes.go # Route definitions
├── internal/
│ └── handlers/ # Request handlers
│ ├── handlers.go # WebSocket handlers
│ ├── home.go # Page handlers
│ └── sse.go # SSE handlers
├── html/ # Jet templates
│ ├── home.jet # Homepage with chat options
│ ├── websocket.jet # WebSocket chat interface
│ └── sse.jet # SSE chat interface
├── static/ # Static assets
├── doc/ # Documentation
│ ├── README.md # Project documentation
│ └── images/ # Screenshots and images
└── go.mod # Go module definition
Technologies Used
- Go
- WebSocket
- Server-Sent Events (SSE)
- Jet Template Engine
- Bootstrap 5
- Reconnecting WebSocket
Getting Started
Prerequisites
- Go 1.16 or higher
- Modern web browser
Installation
-
Clone the repository:
git clone https://github.com/yourusername/wowiweso.git
cd wowiweso
-
Install dependencies:
go mod download
-
Run the application:
go run cmd/web/main.go
-
Open your browser and navigate to:
http://localhost:8080
Features in Detail
WebSocket Chat
- Real-time bidirectional communication
- User presence tracking
- Online users list
- Connection status indicator
- Automatic reconnection
SSE Chat
- Server-sent events for real-time updates
- Simple and efficient one-way communication
- Message broadcasting
- User identification
API Endpoints
GET / - Homepage with chat options
GET /chat/websocket - WebSocket chat interface
GET /chat/sse - SSE chat interface
GET /ws - WebSocket endpoint
GET /sse - SSE endpoint (for establishing SSE connection)
POST /sse - SSE endpoint (for sending messages)
Directories
¶
cmd
|
|
|
|
|
internal
|
|
|
|
|
Click to show internal directories.
Click to hide internal directories.