Documentation
¶
Overview ¶
Package blstr (blaster? blast string?) is an ill-named library for easily setting up best-effort broadcast communication between goroutines.
Synchronization and consistency is traded for speed and predictability of send operations.
The best use case is where perfect consistency may not be necessary and some message loss on slow receivers is more tolerable than choking upstream senders.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteHub ¶
ByteHub implements a multiuser communication channel.
func (*ByteHub) Flood ¶
Flood provides broadcast communication over the hub.
All listening subscribers will receive the message provided. The from field is usually set with the sender ID to be excluded from the broadcast. This allows subscribers to send without having to filter out their own messages.
A count of skipped subscribers (excluding the sender) that are unable to receive the message is returned.
func (*ByteHub) Reset ¶
func (bh *ByteHub) Reset()
Reset removes all subscriptions from the hub and allows it to be reused.
func (*ByteHub) Send ¶
Send provides unicast communication over the hub.
An attempt is made to send a message to the specified subscriber. Errors are returned if the subscriber could not be found or is unable to receive the message.
func (*ByteHub) Subscribe ¶
Subscribe to be notified when broadcast events occur on the hub.
Messages can be dropped if receiver stops listening, or if messages arrive faster than they can be consumed. Channels can be buffered to mitigate this to some extent.
func (*ByteHub) Unsubscribe ¶
Unsubscribe tries to remove the subscription by ID if it exists.