aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevendra2015-06-16 02:03:28 +0530
committerDevendra2015-06-16 02:03:28 +0530
commit4cc9cfe008ea55237f8343f8b132bd25a1bb2d47 (patch)
tree7663ad17ab5523fb904b6c3c6dc82c3bd80b8c87
parentbbb4bfe4dae1e1150f14bb42b5ad6d0f87560cf6 (diff)
downloadpubnub-python-4cc9cfe008ea55237f8343f8b132bd25a1bb2d47.tar.bz2
remove subscribe_sync
-rw-r--r--Pubnub.py62
1 files changed, 1 insertions, 61 deletions
diff --git a/Pubnub.py b/Pubnub.py
index 6df0fc5..37530f5 100644
--- a/Pubnub.py
+++ b/Pubnub.py
@@ -1601,17 +1601,13 @@ class PubnubCoreAsync(PubnubBase):
connect=connect, disconnect=disconnect, reconnect=reconnect, sync=sync)
def _subscribe(self, channels=None, channel_groups=None, state=None, callback=None, error=None,
- connect=None, disconnect=None, reconnect=None, sync=False):
+ connect=None, disconnect=None, reconnect=None):
with self._tt_lock:
self.last_timetoken = self.timetoken if self.timetoken != 0 \
else self.last_timetoken
self.timetoken = 0
- if sync is True and self.subscribe_sync is not None:
- self.subscribe_sync(channel=channels, callback=callback)
- return
-
def _invoke(func, msg=None, channel=None, real_channel=None):
if func is not None:
if msg is not None and channel is not None and real_channel is not None:
@@ -1953,62 +1949,6 @@ class PubnubCore(PubnubCoreAsync):
self.timetoken = 0
self.accept_encoding = 'gzip'
- def subscribe_sync(self, channel, callback, timetoken=0):
- """
- #**
- #* Subscribe
- #*
- #* This is BLOCKING.
- #* Listen for a message on a channel.
- #*
- #* @param array args with channel and callback.
- #* @return false on fail, array on success.
- #**
-
- ## Subscribe Example
- def receive(message) :
- print(message)
- return True
-
- pubnub.subscribe({
- 'channel' : 'hello_world',
- 'callback' : receive
- })
-
- """
-
- subscribe_key = self.subscribe_key
-
- ## Begin Subscribe
- while True:
- try:
- ## Wait for Message
- response = self._request({"urlcomponents": [
- 'subscribe',
- subscribe_key,
- channel,
- '0',
- str(timetoken)
- ], "urlparams": {"uuid": self.uuid, 'pnsdk' : self.pnsdk}})
-
- messages = response[0]
- timetoken = response[1]
-
- ## If it was a timeout
- if not len(messages):
- continue
-
- ## Run user Callback and Reconnect if user permits.
- for message in messages:
- if not callback(self.decrypt(message)):
- return
-
- except Exception:
- time.sleep(1)
-
- return True
-
-
class HTTPClient:
def __init__(self, pubnub, url, urllib_func=None,
callback=None, error=None, id=None, timeout=5):