Skip to content

Commit

Permalink
add Number of messages WS queue shuold hold, default 100
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouaini528 committed Jan 26, 2021
1 parent 1ca49c2 commit b03071f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ $huobi->config([
//Channel data update time,default 0.5 seconds
//'data_time'=>0.5,

//Number of messages WS queue shuold hold, default 100
//'queue_count'=>100,

//Set up subscription platform, default 'spot'
'platform'=>'spot', //options value 'spot' 'future' 'swap' 'linear' 'option'
//Or you can set it like this
Expand Down Expand Up @@ -445,6 +448,9 @@ $huobi->config([
//Channel data update time,default 0.5 seconds
//'data_time'=>0.5,

//Number of messages WS queue shuold hold, default 100
//'queue_count'=>100,

//Set up subscription platform, default 'spot'
'platform'=>'spot', //options value 'spot' 'future' 'swap' 'linear' 'option'
//Or you can set it like this
Expand Down
6 changes: 6 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,9 @@ $huobi->config([
//频道数据更新时间,默认 0.5 秒
//'data_time'=>0.5,

//私有数据队列默认保存100条
//'queue_count'=>100,

//设置订阅平台, 默认 'spot'
'platform'=>'spot', //参数值为 'spot' 'future' 'swap' 'linear' 'option'
//或者也可以这样更灵活的设置
Expand Down Expand Up @@ -438,6 +441,9 @@ $huobi->config([
//频道数据更新时间,默认 0.5 秒
//'data_time'=>0.5,

//私有数据队列默认保存100条
//'queue_count'=>100,

//设置订阅平台, 默认 'spot'
'platform'=>'spot', //参数值为 'spot' 'future' 'swap' 'linear' 'option'
//或者也可以这样更灵活的设置
Expand Down
2 changes: 1 addition & 1 deletion src/Api/WebSocket/SocketGlobal.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function getQueue($key){
*/
protected function saveQueue($key,$value){
//最大存储数据量,超过后保留一条最新的数据,其余数据全部删除。
$max=100;
$max= isset($this->config['queue_count']) ? $this->config['queue_count'] : 100;

if(!isset($this->client->$key)) $this->add($key,[$value]);
else {
Expand Down
10 changes: 1 addition & 9 deletions tests/websocket/client_future.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,7 @@
}

case 10005:{
$huobi->keysecret($key_secret[1]);
$huobi->subscribe();
break;
}

//subscribe
case 10006:{
$huobi->keysecret($key_secret[0]);
$huobi->subscribe();
$huobi->client()->test_reconnection();
break;
}
}
Expand Down
5 changes: 5 additions & 0 deletions tests/websocket/client_spot.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@
$huobi->client()->test2();
break;
}

case 10005:{
$huobi->client()->test_reconnection();
break;
}
}


0 comments on commit b03071f

Please sign in to comment.