* - added PublishWithSk functionality on the Topic implementation
* - fixes after merge
* - complete refactor: used publishing options instead of a new function
* - added one more check in unit test
* - bugfix: use local variables instead of fields
* - renamed tests
That is, when MinTopicSize is used but not WithDiscovery,
Publish will keep waiting until MinTopicSize's condition is met.
At the moment, this is done by polling every 200ms.
In the future, the mechanism could be optimized to be event-based.
A TODO is left for that purpose.
Fixes#454.
When the WithDiscovery option is passed to PubSub then PubSub will be able to search for more peers that are interested in our topics.
This includes the ability for Publishes (via Topic.Publish()) to block until the router is ready to publish. When a router is ready is currently defined by a combination of a user defined MinTopicSize function (passed into topic.Publish via the WithReadiness publish option) and the properties of the pubsub router used. The discovery tests show example usage.
Added PubSub.Join(topic) that returns a Topic object. This object can be Subscribed and Published to as well as to get a TopicEventHandler for topic events. This means that the Subscription object will no longer handle PeerEvents and that PubSub's Publish and Subscribe functions are deprecated.