Categorygithub.com/arborchat/arbor-go
modulepackage
0.2.1
Repository: https://github.com/arborchat/arbor-go.git
Documentation: pkg.go.dev

# README

Arbor-Go

Build Status GoDoc Go Report Card

This is a Golang library implementation of the Arbor chat protocol. It allows you to send and recieve messages over any io.ReadCloser and io.WriteCloser.

Contribute

PRs and suggestions welcome!

# Functions

MakeMessageReader wraps the io.ReadCloser and returns a channel of ProtocolMessage pointers.
MakeMessageWriter wraps the io.Writer and returns a channel of ProtocolMessage pointers.
NewChatMessage constructs a ChatMessage with the provided content.
NewProtocolReader wraps the source to make serializing *ProtocolMessages easy.
NewProtocolReadWriter wraps the given io.ReadWriter so that it is possible to both read and write arbor protocol messages to it.
NewProtocolWriter creates a ProtocolWriter by wrapping a destination io.Writer.
NewStore creates a Store that is ready to be used.
NoopRWCloser wraps an io.ReadWriter with an implementation of io.Closer's Close() method that does nothing.

# Constants

MetaType is the `Type` of a META Message.
NewMessageType should be used as the `Type` field of a NEW_MESSAGE ProtocolMessage.
NewType is the `Type` of a NEW Message.
QueryType should be used as the `Type` field of a QUERY ProtocolMessage.
WelcomeType should be used as the `Type` field of a WELCOME ProtocolMessage.

# Structs

ChatMessage represents a single chat message sent between users.
ProtocolMessage represents a message in the Arbor chat protocol.
ProtocolReader reads arbor protocol messages (as JSON) from an io.Reader.
ProtocolReadWriter can read and write arbor protocol messages (as JSON) from an io.ReadWriter.
ProtocolWriter writes arbor protocol messages (as JSON) to an io.Reader.
Store is a data structure that holds ChatMessages and allows them to be easily looked up by their identifiers.

# Interfaces

Reader defines the behavior of types that can emit arbor protocol messages.
ReadWriteCloser defines the behavior of types that can both emit and consume arbor protocol messages that have a logical "Close" operation (file/socket wrappers, for instance).
ReadWriter defines the behavior of types that can both emit and consume arbor protocol messages.
Writer defines the behavior of types that can consume arbor protocol messages.

# Type aliases

Message is a protocol-layer message in Arbor.
Post
Post is a single chat message within Arbor.