Skip to content

Commit 56be8aa

Browse files
committed
Add websocket_welcome event docs
1 parent f570c2c commit 56be8aa

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

docs/references/events/events.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,13 @@ Client Events
360360

361361
:param SubscriptionRevoked payload: The payload containing token information.
362362

363+
.. py:function:: event_websocket_welcome(payload: ~models.eventsub_.WebsocketWelcome) -> None
364+
:async:
365+
366+
Event dispatched when a websocket successfully connects to Twitch via Eventsub or Conduits.
367+
368+
:param WebsocketWelcome payload: The payload containing information about the connected websocket.
369+
363370

364371
Commands Events
365372
###############
@@ -1384,4 +1391,9 @@ Payloads
13841391
.. attributetable:: twitchio.TokenRefreshedPayload
13851392

13861393
.. autoclass:: twitchio.TokenRefreshedPayload()
1387-
:members:
1394+
:members:
1395+
1396+
.. attributetable:: twitchio.WebsocketWelcome
1397+
1398+
.. autoclass:: twitchio.WebsocketWelcome()
1399+
:members:

twitchio/eventsub/websockets.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ async def _process_welcome(self, data: WelcomeMessage) -> None:
450450

451451
self._listen_task.set_name(f"EventsubWebsocketListener: {self._session_id}")
452452

453-
# TODO: Document Event
454453
if self._client:
455454
event = WebsocketWelcome(payload["session"])
456455
self._client.dispatch("websocket_welcome", payload=event)

twitchio/models/eventsub_.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5568,17 +5568,26 @@ def __repr__(self) -> str:
55685568

55695569

55705570
class WebsocketWelcome:
5571-
# TODO: Docs...
5571+
"""The model received in the :func:`~twitchio.event_websocket_welcome` event.
5572+
5573+
Attributes
5574+
----------
5575+
id: str
5576+
The ID associated with the Websocket, received from Twitch in "session_welcome".
5577+
keepalive_timeout_seconds: int
5578+
The keepalive timeout as an :class:`int` sent and confirmed by Twitch.
5579+
connected_at: :class:`datetime.datetime`
5580+
A :class:`datetime.datetime` representing when this websocket officially connected.
5581+
"""
5582+
55725583
def __init__(self, data: WelcomeSession) -> None:
55735584
self.id: str = data["id"]
5574-
self.status: Literal["connected"] = "connected"
55755585
self.keepalive_timeout_seconds: int = data["keepalive_timeout_seconds"]
5576-
self.reconnect_url: None = None
5577-
self.connected_at: str = data["connected_at"]
5586+
self.connected_at: datetime.datetime = parse_timestamp(data["connected_at"])
55785587

55795588

55805589
class ConduitShard:
5581-
"""ConduitInfo model containing various information about a Shard on a :class:`~twitchio.Conduit`.
5590+
"""ConduitShard model containing various information about a Shard on a :class:`~twitchio.Conduit`.
55825591
55835592
Attributes
55845593
----------
@@ -5729,6 +5738,11 @@ async def update(self, shard_count: int, /) -> Conduit:
57295738
57305739
Method which updates the underlying Conduit on the Twitch API with the provided ``shard_count``.
57315740
5741+
.. important::
5742+
5743+
If you are using :class:`~twitchio.AutoClient` or :class:`~twitchio.ext.commands.AutoBot` this will not
5744+
update the underlying websocket connections. See: :meth:`~twitchio.ConduitInfo.update_shard_count` instead.
5745+
57325746
Parameters
57335747
----------
57345748
shard_count: int

0 commit comments

Comments
 (0)