Categorygithub.com/theflyingcodr/sockets
modulepackage
0.0.12-beta
Repository: https://github.com/theflyingcodr/sockets.git
Documentation: pkg.go.dev

# README

sockets

Channel based socket library on top of gorilla/sockets giving listeners, middleware, server and clients.

Release Build Status CodeQL Status Report codecov Go

Table of Contents

Installation

sockets requires a supported release of Go.

go get -u github.com/theflyingcodr/sockets

Documentation

View the generated documentation

GoDoc

For more information around the technical aspects of Bitcoin, please see the updated Bitcoin Wiki

Features

  • Client / Server implementations
  • Middleware
  • Error handlers
  • Listener funcs
  • Channel based messaging
  • Client reconnects
  • Broadcasting directly from server to client or to entire channel
Library Deployment

goreleaser for easy binary or library deployment to Github and can be installed via: brew install goreleaser.

The .goreleaser.yml file is used to configure goreleaser.

Use make release-snap to create a snapshot version of the release, and finally make release to ship to production.

Examples & Tests

All unit tests and examples run via Github Actions and uses Go version 1.17.x. View the configuration file.

Run all tests

make pre-commit

Usage

View the examples


Maintainers

JH
MS

Contributing

View the contributing guidelines and please follow the code of conduct.

How can I help?

All kinds of contributions are welcome :raised_hands:! The most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon:. You can also support this project by becoming a sponsor on GitHub :clap:


License

License

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

NewMessage will create a new message setting.

# Constants

common headers.
Common messages.
Common messages.
Common messages.
Common messages.
Common messages.
Common messages.
Common messages.

# Variables

ErrChannelNotFound returned when channel is not found.

# Structs

ErrorDetail is returned as the message body in the event of an error.
ErrorMessage is a message type returned on error, it contains a copy of the original key and body but will have a key of "error" allowing this to be checked for in error handlers.
Message is the underlying message type used by the protocol to transmit metadata and the message bodies.
Request is used to send a message to a channel with a specific key.

# Interfaces

Client can be used to implement a client which will send and listen to messages on channels.
ClientPublisher can be implemented to allow a client to send messages to a connected server and channel.
Publisher is used by clients to send messages to a server.
ServerChannelBroadcaster is used to send a message from a server to all clients connected to a channel.
ServerDirectBroadcaster is used to send a message from a server directly to a client.

# Type aliases

ClientErrorHandlerFunc is raised when the client itself returns an error when processing a message.
ClientErrorMsgHandlerFunc is triggered when a server returns an error message in response to a client message.
HandlerFunc defines listeners on both the server and clients.
MiddlewareFunc defines a common middleware signature that can be used to create middleware that executes before the HandlerFunc.
ServerErrorHandlerFunc defines an error handler for a server.