Top 3.4% dependent packages on proxy.golang.org
Top 4.7% dependent repos on proxy.golang.org
Top 8.2% forks on proxy.golang.org
proxy.golang.org : github.com/firstrow/goautosocket
The GAS library provides auto-reconnecting TCP sockets in a tiny, fully tested, thread-safe API. The `TCPClient` struct embeds a `net.TCPConn` and overrides its `Read()` and `Write()` methods, making it entirely compatible with the `net.Conn` interface and the rest of the `net` package. This means you should be able to use this library by just replacing `net.Dial` with `gas.Dial` in your code. GAS uses the `atomic` package to synchronize reconnections between multiple goroutines; it doesn't add any extra locking upon the standard `net.TCPConn` API, except to protect its configuration from races. Hence, you should always use the `TCPClient.Set*` methods *before* you actually start doing any I/O. To test the library, you can run a local TCP server with: and run this code: Then try to kill and reboot your server, the client will automatically reconnect and start sending messages again; unless it has reached its retry limit.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/firstrow/goautosocket
License: MIT
Latest release: over 8 years ago
First release: over 8 years ago
Namespace: github.com/firstrow
Dependent packages: 4
Dependent repositories: 1
Stars: 5 on GitHub
Forks: 5 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago