Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pysher/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Pusher(object):
client_id = "Pysher"
protocol = 6

def __init__(self, key, cluster="", secure=True, secret="", user_data=None, log_level=logging.INFO,
def __init__(self, key, cluster="", secure=True, secret="", user_data=None, user_data_string=None, log_level=logging.INFO,
daemon=True, port=443, reconnect_interval=10, custom_host="", auto_sub=False,
http_proxy_host="", http_proxy_port=0, http_no_proxy=None, http_proxy_auth=None,
**thread_kwargs):
Expand All @@ -24,6 +24,7 @@ def __init__(self, key, cluster="", secure=True, secret="", user_data=None, log_
:param bool secure:
:param bytes or str secret:
:param Optional[Dict] user_data:
:param str user_data_string:
:param str log_level:
:param bool daemon:
:param int port:
Expand All @@ -44,6 +45,7 @@ def __init__(self, key, cluster="", secure=True, secret="", user_data=None, log_

self.key = key
self.secret = secret
self.user_data_string = user_data_string

self.user_data = user_data or {}

Expand Down Expand Up @@ -100,6 +102,8 @@ def subscribe(self, channel_name, auth=None):
data['auth'] = self._generate_auth_token(channel_name)
else:
data['auth'] = auth
if self.user_data_string is not None and channel_name.startswith('presence-'):
data['channel_data'] = self.user_data_string

self.connection.send_event('pusher:subscribe', data)

Expand Down