Skip to content
Merged
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
7 changes: 4 additions & 3 deletions fbchat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,7 @@ def _ping(self, sticky, pool):
'sticky_token': sticky,
'sticky_pool': pool,
'viewer_uid': self.uid,
'state': 'active'
'state': 'active',
}
self._get(self.req_url.PING, data, fix_request=True, as_json=False)

Expand All @@ -1996,14 +1996,15 @@ def _fetchSticky(self):

return j['lb_info']['sticky'], j['lb_info']['pool']

def _pullMessage(self, sticky, pool):
def _pullMessage(self, sticky, pool, markAlive=True):
"""Call pull api with seq value to get message data."""

data = {
"msgs_recv": 0,
"sticky_token": sticky,
"sticky_pool": pool,
"clientid": self.client_id,
'state': 'active' if markAlive else 'offline',
}

j = self._get(ReqUrl.STICKY, data, fix_request=True, as_json=True)
Expand Down Expand Up @@ -2374,7 +2375,7 @@ def doOneListen(self, markAlive=True):
try:
if markAlive:
self._ping(self.sticky, self.pool)
content = self._pullMessage(self.sticky, self.pool)
content = self._pullMessage(self.sticky, self.pool, markAlive)
if content:
self._parseMessage(content)
except KeyboardInterrupt:
Expand Down