Starting to implement a signalling message to when the bot has left
This commit is contained in:
@@ -308,7 +308,7 @@ class SmallWebRTCClient:
|
|||||||
if self.is_connected and not self.is_closing:
|
if self.is_connected and not self.is_closing:
|
||||||
logger.info(f"Disconnecting to Small WebRTC")
|
logger.info(f"Disconnecting to Small WebRTC")
|
||||||
self._closing = True
|
self._closing = True
|
||||||
await self._webrtc_connection.close()
|
await self._webrtc_connection.disconnect()
|
||||||
await self._handle_client_disconnected()
|
await self._handle_client_disconnected()
|
||||||
|
|
||||||
async def send_message(self, frame: TransportMessageFrame | TransportMessageUrgentFrame):
|
async def send_message(self, frame: TransportMessageFrame | TransportMessageUrgentFrame):
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ class SmallWebRTCConnection(BaseObject):
|
|||||||
logger.debug("Closing old peer connection")
|
logger.debug("Closing old peer connection")
|
||||||
# removing the listeners to prevent the bot from closing
|
# removing the listeners to prevent the bot from closing
|
||||||
self._pc.remove_all_listeners()
|
self._pc.remove_all_listeners()
|
||||||
await self.close()
|
await self._close()
|
||||||
# we are initializing a new peer connection in this case.
|
# we are initializing a new peer connection in this case.
|
||||||
self._initialize()
|
self._initialize()
|
||||||
|
|
||||||
@@ -271,7 +271,13 @@ class SmallWebRTCConnection(BaseObject):
|
|||||||
else:
|
else:
|
||||||
logger.warning("Video transceiver not found. Cannot replace video track.")
|
logger.warning("Video transceiver not found. Cannot replace video track.")
|
||||||
|
|
||||||
async def close(self):
|
async def disconnect(self):
|
||||||
|
# TODO: we should trigger something to know we are leaving
|
||||||
|
# so the client does not try to reconnect
|
||||||
|
# Like participant left
|
||||||
|
await self._close()
|
||||||
|
|
||||||
|
async def _close(self):
|
||||||
if self._pc:
|
if self._pc:
|
||||||
await self._pc.close()
|
await self._pc.close()
|
||||||
self._message_queue.clear()
|
self._message_queue.clear()
|
||||||
@@ -296,7 +302,7 @@ class SmallWebRTCConnection(BaseObject):
|
|||||||
await self._call_event_handler(state)
|
await self._call_event_handler(state)
|
||||||
if state == "failed":
|
if state == "failed":
|
||||||
logger.warning("Connection failed, closing peer connection.")
|
logger.warning("Connection failed, closing peer connection.")
|
||||||
await self.close()
|
await self._close()
|
||||||
|
|
||||||
# Despite the fact that aiortc provides this listener, they don't have a status for "disconnected"
|
# Despite the fact that aiortc provides this listener, they don't have a status for "disconnected"
|
||||||
# So, there is no advantage in looking at self._pc.connectionState
|
# So, there is no advantage in looking at self._pc.connectionState
|
||||||
|
|||||||
Reference in New Issue
Block a user