WARNING:binance.websocket.websocket_client:CLOSE frame received, closing websocket connection

Then please tell me why I get this error and how to fix it, I will be very grateful

WebSocket Stream Client

import time
import logging
from binance.websocket.um_futures.websocket_client import UMFuturesWebsocketClient

proxies = {‘http’: ‘http://192.168.31.21:18080’}

def message_handler(_, message):
logging.info(message)

my_client = UMFuturesWebsocketClient(on_message=message_handler, proxies=proxies)

Subscribe to a single symbol stream

my_client.agg_trade(symbol=“bnbusdt”)
time.sleep(5)
logging.info(“closing ws connection”)
my_client.stop()

WARNING:binance.websocket.websocket_client:CLOSE frame received, closing websocket connection

WARNING:binance.websocket.websocket_client:CLOSE frame received, closing websocket connection

Is this related?
2024-02-09

Binance Future is doing Websocket Service upgrade and the upgrade impacts the following:

I followed the documentation and don’t fully understand why it doesn’t work and how to make it work GitHub - binance/binance-connector-python: a simple connector to Binance Public API

Hey,
To work with the um_futures websocket, you should refer to the documentation in the binance-futures-connector-python repository. The error you’re encountering is likely due to the absence of logging configuration.

To resolve this, consider adding the following lines before your proxy setup:

from binance.lib.utils import config_logging

config_logging(logging, logging.DEBUG)
1 Like