From 8b8085e8c508e99da19fc6b170f57d769bf832b7 Mon Sep 17 00:00:00 2001 From: Jason Antman Date: Wed, 4 Dec 2024 22:42:51 -0500 Subject: [PATCH] SocketModeClient expose async event loop param (#1609) --- slack_sdk/socket_mode/aiohttp/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/slack_sdk/socket_mode/aiohttp/__init__.py b/slack_sdk/socket_mode/aiohttp/__init__.py index 5ab05b66..69e39dfa 100644 --- a/slack_sdk/socket_mode/aiohttp/__init__.py +++ b/slack_sdk/socket_mode/aiohttp/__init__.py @@ -8,6 +8,7 @@ import asyncio import logging import time +from asyncio import AbstractEventLoop from asyncio import Future, Lock from asyncio import Queue from logging import Logger @@ -79,6 +80,7 @@ def __init__( on_message_listeners: Optional[List[Callable[[WSMessage], Awaitable[None]]]] = None, on_error_listeners: Optional[List[Callable[[WSMessage], Awaitable[None]]]] = None, on_close_listeners: Optional[List[Callable[[WSMessage], Awaitable[None]]]] = None, + loop: Optional[AbstractEventLoop] = None, ): """Socket Mode client @@ -124,7 +126,7 @@ def __init__( # over the lifetime of your application, # it is suggested you use a single session for the lifetime of your application # to benefit from connection pooling. - self.aiohttp_client_session = aiohttp.ClientSession() + self.aiohttp_client_session = aiohttp.ClientSession(loop=loop) self.on_message_listeners = on_message_listeners or [] self.on_error_listeners = on_error_listeners or []