Skip to content

Commit 608683b

Browse files
authored
Add disconnect method to agent session (#47)
* Add disconnect method to agent session * add docstring
1 parent a76a096 commit 608683b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fishjam/agent/agent.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ async def add_track(self, options: OutgoingAudioTrackOptions):
151151
async def _send(self, message: AgentRequest):
152152
await self._ws.send(bytes(message), text=False)
153153

154+
async def disconnect(self):
155+
"""
156+
Ends the agent session by closing the websocket connection.
157+
Useful when you don't use the context manager to obtain the session.
158+
"""
159+
await self._ws.close()
160+
154161

155162
class Agent:
156163
"""

0 commit comments

Comments
 (0)