8000 GitHub - inference-sh/recws: Reconnecting WebSocket is a websocket client based on gorilla/websocket that will automatically reconnect if the connection is dropped and keeps the connection alive - thread safe!
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
forked from recws-org/recws

Reconnecting WebSocket is a websocket client based on gorilla/websocket that will automatically reconnect if the connection is dropped and keeps the connection alive - thread safe!

License

Notifications You must be signed in to change notification settings

inference-sh/recws

 
 

Repository files navigation

logo

recws

Reconnecting WebSocket is a websocket client based on gorilla/websocket that will automatically reconnect if the connection is dropped - thread safe!

GoDoc Go Report Card GitHub license

Features

  • Automatic reconnection with configurable backoff
  • Thread-safe operations
  • Structured logging with configurable levels
  • Robust keepalive mechanism
  • Proper connection establishment with channel-based synchronization
  • TLS support
  • Proxy support
  • Compression support (RFC 7692)
  • Graceful shutdown support

Installation

go get github.com/inference-sh/recws

Quick Start

import "github.com/inference-sh/recws"

// Create a new reconnecting websocket
ws := &recws.RecConn{
    KeepAliveTimeout: 30 * time.Second,
}

// Connect (blocks until connection is established or timeout reached)
ws.Dial("ws://example.com/ws", nil)

// Send/receive messages
ws.WriteMessage(websocket.TextMessage, []byte("hello"))

Examples

See the examples directory for complete working examples.

Important Note

This library is designed to be used as a WebSocket client (the connecting end) that initiates connections to a WebSocket server. It is not meant to be used for implementing WebSocket server endpoints. If you're looking to implement a WebSocket server, please use the gorilla/websocket package directly instead.

Examples

See the examples directory for complete working examples.

Important Note

This library is designed to be used as a WebSocket client (the connecting end) that initiates connections to a WebSocket server. It is not meant to be used for implementing WebSocket server endpoints. If you're looking to implement a WebSocket server, please use the gorilla/websocket package directly instead.

Logo Credits

License

recws is open-source software licensed under the MIT license.

About

Reconnecting WebSocket is a websocket client based on gorilla/websocket that will automatically reconnect if the connection is dropped and keeps the connection alive - thread safe!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.9%
  • Makefile 2.1%
0