(self, topic: str, discover: bool = False, **kwargs: base.CommonArgs)
return SubChannel(self._client.request('/pubsub/sub', args, stream=True, decoder='json'))
Subscribes to mesages on a given topic
		
		Subscribing to a topic in IPFS means anytime
		a message is published to a topic, the subscribers
		will be notified of the publication.
		
		The connection with the pubsub topic is opened and read.
		The Subscription returned should be used inside a context
		manager to ensure that it is closed properly and not left
		hanging.
		
		.. code-block:: python
		
			>>> sub = client.pubsub.subscribe('testing')
			>>> with client.pubsub.subscribe('testing') as sub:
			... 	# publish a message 'hello' to the topic 'testing'
			... 	client.pubsub.publish('testing', 'hello')
			... 	for message in sub:
			... 		print(message)
			... 		# Stop reading the subscription after
			... 		# we receive one publication
			... 		break
			{'from': '<base64encoded IPFS id>',
			 'data': 'aGVsbG8=',
			 'topicIDs': ['testing']}
			
			# NOTE: in order to receive published data
			# you must already be subscribed to the topic at publication
			# time.
		
		Parameters
		----------
		topic
			Name of a topic to subscribe to
		
		discover
			Try to discover other peers subscibed to the same topic
			(defaults to False)
		
		Returns
		-------
			:class:`SubChannel`
				Generator wrapped in a context manager that maintains a
				connection stream to the given topic.
Subscribes to mesages on a given topic
		
		Subscribing to a topic in IPFS means anytime
		a message is published to a topic, the subscribers
		will be notified of the publication.
		
		The connection with the pubsub topic is opened and read.
		The Subscription returned should be used inside a context
		manager to ensure that it is closed properly and not left
		hanging.
		
		.. code-block:: python
		
			>>> sub = client.pubsub.subscribe('testing')
			>>> with client.pubsub.subscribe('testing') as sub:
			... 	# publish a message 'hello' to the topic 'testing'
			... 	client.pubsub.publish('testing', 'hello')
			... 	for message in sub:
			... 		print(message)
			... 		# Stop reading the subscription after
			... 		# we receive one publication
			... 		break
			{'from': '<base64encoded IPFS id>',
			 'data': 'aGVsbG8=',
			 'topicIDs': ['testing']}
			
			# NOTE: in order to receive published data
			# you must already be subscribed to the topic at publication
			# time.
		
		Parameters
		----------
		topic
			Name of a topic to subscribe to
		
		discover
			Try to discover other peers subscibed to the same topic
			(defaults to False)
		
		Returns
		-------
			:class:`SubChannel`
				Generator wrapped in a context manager that maintains a
				connection stream to the given topic.
Subscribes to mesages on a given topic Subscribing to a topic in IPFS means anytime a message is published to a topic the subscribers will be notified of the publication . The connection with the pubsub topic is opened and read . The Subscription returned should be used inside a context manager to ensure that it is closed properly and not left hanging . .. code - block :: python >>> sub = client . pubsub . subscribe ( testing ) >>> with client . pubsub . subscribe ( testing ) as sub : ... # publish a message hello to the topic testing ... client . pubsub . publish ( testing hello ) ... for message in sub : ... print ( message ) ... # Stop reading the subscription after ... # we receive one publication ... break { from : <base64encoded IPFS id > data : aGVsbG8 = topicIDs : [ testing ] } # NOTE : in order to receive published data # you must already be subscribed to the topic at publication # time . Parameters ---------- topic Name of a topic to subscribe to discover Try to discover other peers subscibed to the same topic ( defaults to False ) Returns ------- : class : SubChannel Generator wrapped in a context manager that maintains a connection stream to the given topic .
def subscribe(self, topic: str, discover: bool = False, **kwargs: base.CommonArgs):
		"""Subscribes to mesages on a given topic
		
		Subscribing to a topic in IPFS means anytime
		a message is published to a topic, the subscribers
		will be notified of the publication.
		
		The connection with the pubsub topic is opened and read.
		The Subscription returned should be used inside a context
		manager to ensure that it is closed properly and not left
		hanging.
		
		.. code-block:: python
		
			>>> sub = client.pubsub.subscribe('testing')
			>>> with client.pubsub.subscribe('testing') as sub:
			... 	# publish a message 'hello' to the topic 'testing'
			... 	client.pubsub.publish('testing', 'hello')
			... 	for message in sub:
			... 		print(message)
			... 		# Stop reading the subscription after
			... 		# we receive one publication
			... 		break
			{'from': '<base64encoded IPFS id>',
			 'data': 'aGVsbG8=',
			 'topicIDs': ['testing']}
			
			# NOTE: in order to receive published data
			# you must already be subscribed to the topic at publication
			# time.
		
		Parameters
		----------
		topic
			Name of a topic to subscribe to
		
		discover
			Try to discover other peers subscibed to the same topic
			(defaults to False)
		
		Returns
		-------
			:class:`SubChannel`
				Generator wrapped in a context manager that maintains a
				connection stream to the given topic.
		"""
		args = (topic, discover)
		return SubChannel(self._client.request('/pubsub/sub', args, stream=True, decoder='json'))
def subscribe ( self , topic : str , discover : bool = False , * * kwargs : base . CommonArgs ) : args = ( topic , discover ) return SubChannel ( self . _client . request ( '/pubsub/sub' , args , stream = True , decoder = 'json' ) )