Skip to content

Commit

Permalink
Merge pull request #482 from ChIoT-Tech/master
Browse files Browse the repository at this point in the history
Remove markdown code blocks from comments (as godoc does not handle this)
  • Loading branch information
MattBrittan committed Jan 28, 2021
2 parents 89c3cd2 + 68d9c2e commit 18bfbde
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
36 changes: 18 additions & 18 deletions client.go
Expand Up @@ -79,19 +79,19 @@ type Client interface {
// Subscribe starts a new subscription. Provide a MessageHandler to be executed when
// a message is published on the topic provided, or nil for the default handler.
//
// If `options.OrderMatters` is true (the default) then `callback` must not block or
// call functions within this package that may block (e.g. `Publish`) other than in
// If options.OrderMatters is true (the default) then callback must not block or
// call functions within this package that may block (e.g. Publish) other than in
// a new go routine.
// `callback` must be safe for concurrent use by multiple goroutines.
// callback must be safe for concurrent use by multiple goroutines.
Subscribe(topic string, qos byte, callback MessageHandler) Token
// SubscribeMultiple starts a new subscription for multiple topics. Provide a MessageHandler to
// be executed when a message is published on one of the topics provided, or nil for the
// default handler.
//
// If `options.OrderMatters` is true (the default) then `callback` must not block or
// call functions within this package that may block (e.g. `Publish`) other than in
// If options.OrderMatters is true (the default) then callback must not block or
// call functions within this package that may block (e.g. Publish) other than in
// a new go routine.
// `callback` must be safe for concurrent use by multiple goroutines.
// callback must be safe for concurrent use by multiple goroutines.
SubscribeMultiple(filters map[string]byte, callback MessageHandler) Token
// Unsubscribe will end the subscription from each of the topics provided.
// Messages published to those topics from other clients will no longer be
Expand All @@ -102,10 +102,10 @@ type Client interface {
// for parts of a wildcard subscription or for receiving retained messages
// upon connection (before Sub scribe can be processed).
//
// If `options.OrderMatters` is true (the default) then `callback` must not block or
// call functions within this package that may block (e.g. `Publish`) other than in
// If options.OrderMatters is true (the default) then callback must not block or
// call functions within this package that may block (e.g. Publish) other than in
// a new go routine.
// `callback` must be safe for concurrent use by multiple goroutines.
// callback must be safe for concurrent use by multiple goroutines.
AddRoute(topic string, callback MessageHandler)
// OptionsReader returns a ClientOptionsReader which is a copy of the clientoptions
// in use by the client.
Expand Down Expand Up @@ -174,10 +174,10 @@ func NewClient(o *ClientOptions) Client {
// without making a subscription. For example having a different handler
// for parts of a wildcard subscription
//
// If `options.OrderMatters` is true (the default) then `callback` must not block or
// call functions within this package that may block (e.g. `Publish`) other than in
// If options.OrderMatters is true (the default) then callback must not block or
// call functions within this package that may block (e.g. Publish) other than in
// a new go routine.
// `callback` must be safe for concurrent use by multiple goroutines.
// callback must be safe for concurrent use by multiple goroutines.
func (c *client) AddRoute(topic string, callback MessageHandler) {
if callback != nil {
c.msgRouter.addRoute(topic, callback)
Expand Down Expand Up @@ -711,10 +711,10 @@ func (c *client) Publish(topic string, qos byte, retained bool, payload interfac
// Subscribe starts a new subscription. Provide a MessageHandler to be executed when
// a message is published on the topic provided.
//
// If `options.OrderMatters` is true (the default) then `callback` must not block or
// call functions within this package that may block (e.g. `Publish`) other than in
// If options.OrderMatters is true (the default) then callback must not block or
// call functions within this package that may block (e.g. Publish) other than in
// a new go routine.
// `callback` must be safe for concurrent use by multiple goroutines.
// callback must be safe for concurrent use by multiple goroutines.
func (c *client) Subscribe(topic string, qos byte, callback MessageHandler) Token {
token := newToken(packets.Subscribe).(*SubscribeToken)
DEBUG.Println(CLI, "enter Subscribe")
Expand Down Expand Up @@ -792,10 +792,10 @@ func (c *client) Subscribe(topic string, qos byte, callback MessageHandler) Toke
// SubscribeMultiple starts a new subscription for multiple topics. Provide a MessageHandler to
// be executed when a message is published on one of the topics provided.
//
// If `options.OrderMatters` is true (the default) then `callback` must not block or
// call functions within this package that may block (e.g. `Publish`) other than in
// If options.OrderMatters is true (the default) then callback must not block or
// call functions within this package that may block (e.g. Publish) other than in
// a new go routine.
// `callback` must be safe for concurrent use by multiple goroutines.
// callback must be safe for concurrent use by multiple goroutines.
func (c *client) SubscribeMultiple(filters map[string]byte, callback MessageHandler) Token {
var err error
token := newToken(packets.Subscribe).(*SubscribeToken)
Expand Down
12 changes: 6 additions & 6 deletions options.go
Expand Up @@ -50,7 +50,7 @@ type OnConnectHandler func(Client)
type ReconnectHandler func(Client, *ClientOptions)

// ClientOptions contains configurable options for an Client. Note that these should be set using the
// relevant methods (e.g. `AddBroker`) rather than directly. See those functions for information on usage.
// relevant methods (e.g. AddBroker) rather than directly. See those functions for information on usage.
type ClientOptions struct {
Servers []*url.URL
ClientID string
Expand Down Expand Up @@ -209,8 +209,8 @@ func (o *ClientOptions) SetCleanSession(clean bool) *ClientOptions {
// from the client to the application and possibly arrive out of order.
// Specifically, the message handler is called in its own go routine.
// Note that setting this to true does not guarantee in-order delivery
// (this is subject to broker settings like `max_inflight_messages=1` in mosquitto)
// and if `true` then handlers must not block.
// (this is subject to broker settings like "max_inflight_messages=1" in mosquitto)
// and if true then handlers must not block.
func (o *ClientOptions) SetOrderMatters(order bool) *ClientOptions {
o.Order = order
return o
Expand Down Expand Up @@ -291,10 +291,10 @@ func (o *ClientOptions) SetBinaryWill(topic string, payload []byte, qos byte, re
// SetDefaultPublishHandler sets the MessageHandler that will be called when a message
// is received that does not match any known subscriptions.
//
// If `options.OrderMatters` is true (the default) then `defaultHandler` must not block or
// call functions within this package that may block (e.g. `Publish`) other than in
// If OrderMatters is true (the defaultHandler) then callback must not block or
// call functions within this package that may block (e.g. Publish) other than in
// a new go routine.
// `defaultHandler` must be safe for concurrent use by multiple goroutines.
// defaultHandler must be safe for concurrent use by multiple goroutines.
func (o *ClientOptions) SetDefaultPublishHandler(defaultHandler MessageHandler) *ClientOptions {
o.DefaultPublishHandler = defaultHandler
return o
Expand Down

0 comments on commit 18bfbde

Please sign in to comment.