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 ce2d4f5 commit 2ab1f54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ $okex->config([

//Channel data update time,0.1 seconds
//'data_time'=>0.1,

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

$okex->start();
Expand Down Expand Up @@ -561,6 +564,9 @@ $okex->config([

//Channel data update time,0.1 seconds
//'data_time'=>0.1,

//Number of messages WS queue shuold hold, default 100
//'queue_count'=>100,
]);
```

Expand Down
6 changes: 6 additions & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,9 @@ $okex->config([

//频道数据更新时间,默认 0.1 秒
//'data_time'=>0.1,

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

$okex->start();
Expand Down Expand Up @@ -560,6 +563,9 @@ $okex->config([

//频道数据更新时间,默认 0.1 秒
//'data_time'=>0.1,

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

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 @@ -70,7 +70,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

0 comments on commit 2ab1f54

Please sign in to comment.