Skip to content

Commit f02154b

Browse files
authored
fix a forgotten nonce (#338)
* Fixed a forgotten nonce * black and changelog
1 parent 92581ce commit f02154b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Master
3636
- Websocket automatically handles "RECONNECT" requests by Twitch
3737
- Bug fixes
3838
- Unsubscribing from Pubsubevents works again
39+
- Fix a forgotten nonce in :func:`~twitchio.ext.pubsub.websocket._send_topics`
3940

4041
- ext.sound
4142
- Bug fixes

twitchio/ext/pubsub/websocket.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ async def _send_initial_topics(self):
119119
async def _send_topics(self, topics: List[Topic], type="LISTEN"):
120120
for tok, _topics in groupby(topics, key=lambda val: val.token):
121121
nonce = ("%032x" % uuid.uuid4().int)[:8]
122-
payload = {"type": type, "data": {"topics": [x.present for x in _topics], "auth_token": tok}}
122+
payload = {
123+
"type": type,
124+
"nonce": nonce,
125+
"data": {"topics": [x.present for x in _topics], "auth_token": tok},
126+
}
123127
logger.debug(f"Sending {type} payload with nonce '{nonce}': {payload}")
124128
await self.send(payload)
125129

0 commit comments

Comments
 (0)