Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. golongpoll

golongpoll

MITGov1.3.1

A Go library for implementing HTTP long-polling servers and clients to enable web pub-sub communication.

GitHubGitHub
668 stars60 forks0 contributors

What is golongpoll?

golongpoll is a Go library that simplifies implementing HTTP long-polling for web pub-sub communication. It provides both server-side and client-side components to enable real-time event delivery between web clients and servers without requiring WebSockets or complex infrastructure.

Target Audience

Go developers building web applications that need real-time updates, such as chat systems, live notifications, or dashboard monitoring, where WebSockets are not feasible or desired.

Value Proposition

Developers choose golongpoll for its simplicity and minimalism, offering a straightforward, configurable long-polling implementation with in-memory buffering, category-based events, and optional persistence, reducing internal complexity while remaining flexible for various web application needs.

Overview

golang long polling library. Makes web pub-sub easy via HTTP long-poll servers and clients :smiley: :coffee: :computer:

Use Cases

Best For

  • Implementing real-time notifications in web applications without WebSockets
  • Building lightweight chat systems using HTTP long-polling
  • Creating live dashboard updates for monitoring or analytics
  • Adding pub-sub functionality to Go HTTP servers with minimal setup
  • Integrating long-polling into Gin framework applications
  • Scenarios requiring event persistence across server restarts via file add-ons

Not Ideal For

  • Applications requiring real-time, bidirectional communication with low latency, such as online gaming or financial trading platforms, where WebSockets are more suitable.
  • Projects where clients need to subscribe to multiple event categories in a single HTTP request, as golongpoll's subscription handler only supports one category per call.
  • High-traffic systems with millions of concurrent connections, due to reliance on in-memory buffering that may not scale without persistence add-ons and additional infrastructure.
  • Teams needing built-in authentication or advanced security features out-of-the-box, as it requires custom HTTP handler wrapping, as shown in the authentication example.

Pros & Cons

Pros

Simple Setup

The QuickStart example shows creating a server with just a few lines of code using default options, making it easy to integrate long-polling into Go applications without complex configuration.

Configurable Event Management

Options like MaxEventBufferSize and EventTimeToLiveSeconds allow precise control over event storage and expiration, as documented in the go docs, enabling tailored behavior for different use cases.

Framework Integration

Works seamlessly with standard Go HTTP servers and can be wrapped for use with Gin, as demonstrated in the 'long polling and gin' section, providing flexibility for various web frameworks.

Client Library Support

Includes both Go and JavaScript clients, simplifying web integration without needing to implement the HTTP API from scratch, as highlighted in the examples directory.

Cons

Single-Category Subscription Limitation

The README explicitly states that subscription handlers support only one category per call, requiring multiple requests for multi-category needs, a design decision that reduces flexibility for complex event systems.

Default Volatile Storage

Events are stored in-memory by default, leading to data loss on server restarts unless the optional FilePersistorAddOn is used, which adds extra setup and complexity not included in the core library.

Performance Trade-offs

HTTP long-polling inherently has higher latency and resource usage compared to WebSockets or Server-Sent Events, making it less efficient for high-frequency update scenarios, as noted in the library's focus on simplicity over speed.

Frequently Asked Questions

Quick Stats

Stars668
Forks60
Contributors0
Open Issues0
Last commit2 years ago
CreatedSince 2015

Tags

#event-driven#http-server#go-library#golang-library#client-library#golang#pubsub#pub-sub#go#real-time#long-polling

Built With

G
Go
G
Gin

Included in

Go169.1k
Auto-fetched 59 minutes ago

Related Projects

AsynqAsynq

Simple, reliable, and efficient distributed task queue in Go

Stars13,228
Forks929
Last commit2 hours ago
saramasarama

Sarama is a Go library for Apache Kafka.

Stars12,474
Forks1,842
Last commit7 hours ago
CentrifugoCentrifugo

Scalable real-time messaging server in a language-agnostic way. Self-hosted alternative to Pubnub, Pusher, Ably, socket.io, Phoenix.PubSub, SignalR. Set up once and forever.

Stars10,233
Forks698
Last commit2 days ago
WatermillWatermill

Building event-driven applications the easy way in Go.

Stars9,691
Forks496
Last commit14 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub