Skip to content

estxbxn/server-sent-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server-Sent Events (SSE) Demo with Bun

A modern TypeScript monorepo demonstrating real-time communication using Server-Sent Events (SSE) with Bun runtime.

🚀 Features

  • Real-time server-to-client communication using SSE
  • TypeScript implementation for both client and server
  • Modern Bun runtime for optimal performance
  • Clean and responsive UI
  • Automatic reconnection handling
  • Cross-Origin Resource Sharing (CORS) enabled

📁 Project Structure

packages/
├── client/          # SSE client application
│   ├── src/         # Source code
│   └── package.json # Client dependencies
└── server/          # SSE server implementation
    ├── src/         # Source code
    └── package.json # Server dependencies

🛠️ Prerequisites

  • Bun (v1.0.0 or higher)
  • Node.js (v18.0.0 or higher)
  • A modern web browser

🚀 Getting Started

  1. Clone the repository

    git clone <repository-url>
    cd server-sent-events
  2. Install dependencies

    bun install
  3. Start the server

    cd packages/server
    bun run dev
  4. Start the client

    cd packages/client
    bun run dev
  5. Access the application

🔧 Development

Server

  • Runs on port 3000
  • SSE endpoint: /events
  • Sends messages every 2 seconds
  • Handles client disconnections gracefully

Client

  • Runs on port 8000
  • Connects to SSE server
  • Displays real-time messages
  • Provides connection status
  • Allows manual connection/disconnection

About

A modern TypeScript monorepo demonstrating real-time communication using Server-Sent Events (SSE) with Bun runtime.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors