Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FanOut ¶
func (*FanOut[T]) AddOutputs ¶
func (fo *FanOut[T]) AddOutputs(channels ...chan []T)
func (*FanOut[T]) RemoveOutput ¶
func (fo *FanOut[T]) RemoveOutput(output chan []T)
type ReaderChan ¶
type ReaderChan[R any, D any] struct { ReaderWriterBase[R, D] Read func() (*R, error) // contains filtered or unexported fields }
func (*ReaderChan[R, D]) Channel ¶
func (rc *ReaderChan[R, D]) Channel() chan ValueOrError[R]
*
- Returns the conn's reader channel.
func (*ReaderChan[R, D]) IsRunning ¶
func (ch *ReaderChan[R, D]) IsRunning() bool
*
- Returns whether the connection reader/writer loops are running.
func (*ReaderChan[R, D]) Start ¶
func (rc *ReaderChan[R, D]) Start() (err error)
func (*ReaderChan[T, D]) Stop ¶
func (ch *ReaderChan[T, D]) Stop() error
*
- This method is called to stop the channel
- If already connected then nothing is done and nil
- is not already connected, a connection will first be established
- (including auth and refreshing tokens) and then the reader and
- writers are started. SendRequest can be called to send requests
- to the peer and the (user provided) msgChannel will be used to
- handle messages from the server.
type ReaderWriterBase ¶
type ReaderWriterBase[T any, D any] struct { Info D // Time allowed to read the next pong message from the peer. WaitTime time.Duration // contains filtered or unexported fields }
func (*ReaderWriterBase[T, D]) Start ¶
func (rwb *ReaderWriterBase[T, D]) Start() error
func (*ReaderWriterBase[T, D]) WaitForFinish ¶
func (rwb *ReaderWriterBase[T, D]) WaitForFinish()
*
- Waits until the socket connection is disconnected or manually stopped.
type ValueOrError ¶
type WriterChan ¶
type WriterChan[W any, D any] struct { ReaderWriterBase[W, D] Write func(msg *W) error OnClose func() // contains filtered or unexported fields }
func (*WriterChan[W, D]) IsRunning ¶
func (ch *WriterChan[W, D]) IsRunning() bool
*
- Returns whether the connection reader/writer loops are running.
func (*WriterChan[W, D]) Send ¶
func (wc *WriterChan[W, D]) Send(req *W) bool
func (*WriterChan[W, D]) Start ¶
func (wc *WriterChan[W, D]) Start() (err error)
Start writer goroutine
func (*WriterChan[T, D]) Stop ¶
func (ch *WriterChan[T, D]) Stop() error
*
- This method is called to stop the channel
- If already connected then nothing is done and nil
- is not already connected, a connection will first be established
- (including auth and refreshing tokens) and then the reader and
- writers are started. SendRequest can be called to send requests
- to the peer and the (user provided) msgChannel will be used to
- handle messages from the server.
Click to show internal directories.
Click to hide internal directories.