MCPcopy Create free account
hub / github.com/ccxt/ccxt / create_connection

Method create_connection

python/ccxt/async_support/base/ws/client.py:288–301  ·  view source on GitHub ↗
(self, session)

Source from the content-addressed store, hash-verified

286 self.on_error(error)
287
288 def create_connection(self, session):
289 # autoping is responsible for automatically replying with pong
290 # to a ping incoming from a server, we have to disable autoping
291 # with aiohttp's websockets and respond with pong manually
292 # otherwise aiohttp's websockets client won't trigger WSMsgType.PONG
293 # call aenter here to simulate async with otherwise we get the error "await not called with future"
294 # if connecting to a non-existent endpoint
295 # set cookies if defined
296 if 'cookies' in self.options:
297 for key, value in self.options['cookies'].items():
298 session.cookie_jar.update_cookies({key: value})
299 if (self.proxy):
300 return session.ws_connect(self.url, autoping=False, autoclose=False, headers=self.options.get('headers'), proxy=self.proxy, max_msg_size=10485760).__aenter__()
301 return session.ws_connect(self.url, autoping=False, autoclose=False, headers=self.options.get('headers'), max_msg_size=10485760).__aenter__()
302
303 async def send(self, message):
304 if self.verbose:

Callers 1

openMethod · 0.95

Calls 2

__aenter__Method · 0.80
getMethod · 0.45

Tested by

no test coverage detected