Open mohammad-rj opened 3 years ago
For User Data Streams, I have not set up a reconnection mechanism, only public data is reconnected. Because I am worried that it is not triggered by the initiative, there will be a risk of losing private data. Your business end can set up a monitoring application to determine whether the User Data Streams is disconnected. Simply disconnect and re-subscribe. Let me think about whether we need to improve this one.
what is the best way? i must delete or unsubscribe the last private subscribe and subscribe again? Or is there a better way? can we add this mechanism on main code ?
What version of binance-php do you currently have? Is it 2.1.1?
I'm up to the latest commit
You look at your log if there is this information "private connection close,ready to reconnect"
Are you subscribing to spot, future, or delivery?
usdt-future where i must looking for this log ? "private connection close,ready to reconnect"
private function reconnection($global,$type='public',array $keysecret=[]){ $all_sub=$global->get('all_sub'); if(empty($all_sub)) return;
if($type=='public'){
$temp=[];
foreach ($all_sub as $v){
if(!is_array($v)) $temp[]=$v;
}
$global->save('add_sub',$temp);
}else{
}
}
and what is this function ?
can we have a function for reconnection private channel ?
You gave too little information. You need to check the log. I can't locate the problem. But in this case, your business end only needs to re-subscribe once.
This log is in the location set by your config, and the location in the code is at 'private connection close,ready to reconnect'
private function reconnection($global,$type='public',array $keysecret=[]){
$all_sub=$global->get('all_sub');
if(empty($all_sub)) return;
if($type=='public'){
$temp=[];
foreach ($all_sub as $v){
if(!is_array($v)) $temp[]=$v;
}
$global->save('add_sub',$temp);
}else{
}
}
This code indicates that when the user disconnects, they need to re-subscribe to the data. I haven't perfected it here, I only completed the public data. Next I have to complete the right place
I will finish reconnecting to the private channel as soon as possible
this must was in usdt-future-server2021-06-16-2021-06-17.txt log of server_usdt_future.php , right ? but there is no "private connection close,ready to reconnect"
also when i check test function, that u define for test and debug with switch number 99 on client_usdt_future.php it say : [secret] => xxx my secret [connection] => 1 [listen_key] => xxx my listen_key [listen_key_time] => 1623918598 [connection_close] => 0
connection is true and connection_close is false also it just past 42 minutes of this [listen_key_time] => 1623918598 (its fresh)
i think the reconnecting work truly, but after 24 h binance does not recognize as valid !
I think the previous key should be deleted and a new key created, every 24 hours based on what is described in the Bainance document "A single connection to fstream.binance.com is only valid for 24 hours; expect to be disconnected at the 24 hour mark" https://binance-docs.github.io/apidocs/futures/en/#user-data-streams
what do you think ? did I get it right?
Your findings are very useful, I need time to test, after the test is successful, I will @you
Hello, I didn't find 24-hour disconnection after the test. Look at my screenshot, running time is 2021-06-17, I changed the account order, executed and got the data.
I'm using spot. I'll try futures.
I have seen this problem several times on futures
I am testing futures, please wait for my test results
After 26 hours of testing, I found no disconnection. I changed my account balance and successfully received the data. I will now extend the test time on this basis.
oh, so why this issue happened for me ? is it possible it happened because of queue
The queue data saves 100 pieces of data by default, you can set it by configuring queue_count=100. Because I only do a small amount of data test, I will try to add a lot of data later. please wait for my test results
$binance->config([
//Number of messages WS queue shuold hold, default 100
'queue_count'=>100,
]);
After 6 days 20 hours of testing, I found no disconnection.
after 24 hours our private subscription expires and does not receive the account and order update