Skip to content

Commit a6c2bbb

Browse files
committed
fix eventsub reconnect (again)
1 parent faee30b commit a6c2bbb

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Master
2020
- ext.eventsub
2121
- Bug fixes
2222
- Fix websocket reconnection event.
23+
- Fix another websocket reconnect issue where it tried to decode nonexistent headers.
2324

2425

2526
2.7.0

twitchio/ext/eventsub/models.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,21 @@ class ReconnectEvent(BaseEvent):
248248

249249
__slots__ = ("reconnect_url", "connected_at")
250250

251+
def __init__(
252+
self, client: Union[EventSubClient, EventSubWSClient], _data: Union[str, dict], request: Optional[web.Request]
253+
):
254+
# we skip the super init here because reconnect events dont have headers or subscription information
255+
256+
self._client = client
257+
self._raw_data = _data
258+
259+
if isinstance(_data, str):
260+
data: dict = _loads(_data)
261+
else:
262+
data = _data
263+
264+
self.setup(data["payload"])
265+
251266
def setup(self, data: dict):
252267
self.reconnect_url: str = data["session"]["reconnect_url"]
253268
self.connected_at: datetime.datetime = _parse_datetime(data["session"]["connected_at"])

0 commit comments

Comments
 (0)