From 7b3fab9398930fc03cfaa757f88a5715db09f5be Mon Sep 17 00:00:00 2001 From: Vadim Vlasov Date: Thu, 20 Jan 2022 21:16:03 +0300 Subject: [PATCH 1/2] Fixed comment for Subscribe method --- nats.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nats.go b/nats.go index 840a1ffc1..2c42796cc 100644 --- a/nats.go +++ b/nats.go @@ -3738,7 +3738,7 @@ func (nc *Conn) respToken(respInbox string) string { } // Subscribe will express interest in the given subject. The subject -// can have wildcards (partial:*, full:>). Messages will be delivered +// can have wildcards (partial.*, full.>). Messages will be delivered // to the associated MsgHandler. func (nc *Conn) Subscribe(subj string, cb MsgHandler) (*Subscription, error) { return nc.subscribe(subj, _EMPTY_, cb, nil, false, nil) From d2b3332579c99d87824d1a4e421159cb34a34f0c Mon Sep 17 00:00:00 2001 From: Vadim Vlasov Date: Thu, 20 Jan 2022 23:48:02 +0300 Subject: [PATCH 2/2] Extended comment for Subscribe method --- nats.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nats.go b/nats.go index 2c42796cc..85c964b0a 100644 --- a/nats.go +++ b/nats.go @@ -3738,8 +3738,13 @@ func (nc *Conn) respToken(respInbox string) string { } // Subscribe will express interest in the given subject. The subject -// can have wildcards (partial.*, full.>). Messages will be delivered -// to the associated MsgHandler. +// can have wildcards. +// There are two type of wildcards: * for partial, and > for full. +// A subscription on subject time.*.east would receive messages sent to time.us.east and time.eu.east. +// A subscription on subject time.us.> would receive messages sent to +// time.us.east and time.us.east.atlanta, while time.us.* would only match time.us.east +// since it can't match more than one token. +// Messages will be delivered to the associated MsgHandler. func (nc *Conn) Subscribe(subj string, cb MsgHandler) (*Subscription, error) { return nc.subscribe(subj, _EMPTY_, cb, nil, false, nil) }