wowiweso

module
v0.0.0-...-117d3b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2025 License: GPL-3.0

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

WebSocket Chat Real-time chat with user presence tracking

SSE Chat

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
  1. Clone the repository:

    git clone https://github.com/yourusername/wowiweso.git
    cd wowiweso
    
  2. Install dependencies:

    go mod download
    
  3. Run the application:

    go run cmd/web/main.go
    
  4. 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

Path Synopsis
cmd
web command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL