MCPcopy Index your code
hub / github.com/slackapi/python-slack-sdk / connect

Method connect

slack_sdk/socket_mode/builtin/client.py:156–193  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

154 return self.current_session is not None and self.current_session.is_active()
155
156 def connect(self) -> None:
157 old_session: Optional[Connection] = self.current_session
158 old_current_session_state: ConnectionState = self.current_session_state
159
160 if self.wss_uri is None:
161 self.wss_uri = self.issue_new_wss_url()
162
163 current_session = Connection(
164 url=self.wss_uri,
165 logger=self.logger,
166 ping_interval=self.ping_interval,
167 trace_enabled=self.trace_enabled,
168 all_message_trace_enabled=self.all_message_trace_enabled,
169 ping_pong_trace_enabled=self.ping_pong_trace_enabled,
170 receive_buffer_size=self.receive_buffer_size,
171 proxy=self.proxy,
172 proxy_headers=self.proxy_headers,
173 on_message_listener=self._on_message,
174 on_error_listener=self._on_error,
175 on_close_listener=self._on_close,
176 ssl_context=self.web_client.ssl,
177 )
178 current_session.connect()
179
180 if old_current_session_state is not None:
181 old_current_session_state.terminated = True
182 if old_session is not None:
183 old_session.close()
184
185 self.current_session = current_session
186 self.current_session_state = ConnectionState()
187 self.auto_reconnect_enabled = self.default_auto_reconnect_enabled
188
189 if not self.current_app_monitor_started:
190 self.current_app_monitor_started = True
191 self.current_app_monitor.start()
192
193 self.logger.info(f"A new session has been established (session id: {self.session_id()})")
194
195 def disconnect(self) -> None:
196 if self.current_session is not None:

Callers 12

mainFunction · 0.95
mainFunction · 0.95
mainFunction · 0.95
test_interactionsMethod · 0.95
test_interactionsMethod · 0.95
test_interactionsMethod · 0.95
test_interactionsMethod · 0.95

Calls 7

connectMethod · 0.95
session_idMethod · 0.95
ConnectionClass · 0.85
ConnectionStateClass · 0.85
issue_new_wss_urlMethod · 0.45
closeMethod · 0.45
startMethod · 0.45