I'm using pubnub with python SDK. I have some testing environment written in python and I'm trying to write python code to add pubnub client subscribe to channel and unsubscribe. In the server I'm checking that the server gets join and leave messages (I'm using presence channel).
The problem is that when the thread dies I don't get leave message and I don't see any unsubscribe call in the python code to do explicit unsubscribe.
Any ideas?
Thanks.
My code looks something like this:
def main(user_id,channel_name):
t = Thread(target=rt_subscribe,args=(user_id,channel_name))
def rt_subscribe(user_id,channel_name):
def get_message(msg):
print 'got message: %s' % msg
return True
pb = Pubnub(publish_key=PUBLISH_KEY,
subscribe_key=SUBSCRIBE_KEY,
pres_uuid=user_id,
ssl_on=False)
pb.subscribe({
'channel' : channel_name,
'callback' : get_message
})