eee
This commit is contained in:
+37
-19
@@ -14,33 +14,50 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body style="background-color: #666;color: #fff;presentation-level: increment;">
|
<body style="background-color: #666;color: #fff;presentation-level: increment;">
|
||||||
<video id="output" width="320" height="240" autoplay></video>
|
<!--<video id="output" width="320" height="240" autoplay></video>-->
|
||||||
<pre id="format"></pre>
|
<pre id="format"></pre>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
let sock, tick, format = document.getElementById('format');
|
let sock, tick, format = document.getElementById('format');
|
||||||
|
|
||||||
|
|
||||||
let buffer;
|
// let buffer;
|
||||||
let ms = new MediaSource()
|
// let ms = new MediaSource()
|
||||||
let output = document.getElementById('output')
|
let unique = '';
|
||||||
output.src = URL.createObjectURL(ms)
|
|
||||||
ms.onsourceopen = () => {
|
// let output = document.getElementById('output')
|
||||||
buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp8"')
|
// output.src = URL.createObjectURL(ms)
|
||||||
}
|
// ms.onsourceopen = () => {
|
||||||
|
// buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp8"')
|
||||||
|
// }
|
||||||
|
|
||||||
function message(message) {
|
function message(message) {
|
||||||
// let div = document.createElement('div');
|
try {
|
||||||
// div.innerHTML = message.data;
|
let data = JSON.parse(message.data);
|
||||||
// div.style.cssText = 'padding:5px 10px;background-color:#222;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;word-break: break-all;word-wrap: break-word;';
|
if (data.event === 'user::kick') {
|
||||||
// div.style.marginBottom = '10px';
|
return;
|
||||||
// let count = format.getElementsByTagName('div');
|
}
|
||||||
|
if (unique === '') {
|
||||||
|
unique = message.data;
|
||||||
|
}
|
||||||
|
if (data["ack"]) {
|
||||||
|
sock.send(JSON.stringify({'event': 'ack', 'id': unique, 'data': {'ack': data["ack"]}}));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (unique === '') {
|
||||||
|
unique = message.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let div = document.createElement('div');
|
||||||
|
div.innerHTML = message.data;
|
||||||
|
div.style.cssText = 'padding:5px 10px;background-color:#222;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;word-break: break-all;word-wrap: break-word;';
|
||||||
|
div.style.marginBottom = '10px';
|
||||||
|
let count = format.getElementsByTagName('div');
|
||||||
|
|
||||||
buffer.appendBuffer(new Uint8Array(message.data))
|
format.insertBefore(div, count[0]);
|
||||||
|
|
||||||
// format.insertBefore(div, count[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(even) {
|
function close(even) {
|
||||||
|
unique = '';
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
connect();
|
connect();
|
||||||
sock.onmessage = message;
|
sock.onmessage = message;
|
||||||
@@ -50,13 +67,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connect() {
|
function connect() {
|
||||||
sock = new WebSocket('wss://center-wss.stupideyes.com/ws?access_token=6648f48a-466ba-6394-70527ef8b-bc47b8');
|
sock = new WebSocket('wss://center-wss.stupideyes.com/ws?access_token=a8exu0la-77ecu-ijhk-inkgt6vln-rlwwuk');
|
||||||
sock.onopen = function () {
|
// sock = new WebSocket('wss://meet-bottle.zhuangb123.com/socket/?auth=dG9rZW49M2I2ODJhNzg0NS0xMTktMzBiMS1mMDkxOGRhNjktNTg2ZDEyJnRpbWU9MTc1MzA4MTI5MyZyZWZyZXNoPXBDT0VFYk9KOG8xTEVZQytyUkR4VlZIaXR1TmVWcndCY2crRTBua2U1ZkJuUWNJaHl6NUtTV0x2ZExXa1Y5aXlyK3NmRnRwOVRCVU91MnhPSVRPRjROTjhoT0hlODNNVmZjN1NXb2QyeDY0TXEvZTFEUCtySjNzNjZhVlplcXdYV0QzV2VRd0V6YkowZ29oOFFqRHVvZGcyb281OEZkZVp5TjVIcHFyejRZQ0VMbkxydXlCUmpFdjNTWnRsQ3gxMWthNDNxbEwzM1lJYVlaV2t3dEhOMm9VaXllNFpKOHFnU1FueEZ4N0c4RDhabzBhajFFeEJIZTlJUFQ0VUo3UkR0V0g2Y3A3bkY3bXlkVHB4Wnp5NG1kRlgxa3M5eC9iVlJHaVFDRnU4VEFsUVdDdHEzbmJ1TnNYZVd3Q2dXWEd1OEUzMld3THVFRzRCZFRCanA2MGtYUT09');
|
||||||
|
sock.onopen = function (data) {
|
||||||
if (tick) {
|
if (tick) {
|
||||||
clearInterval(tick)
|
clearInterval(tick)
|
||||||
}
|
}
|
||||||
tick = setInterval(function () {
|
tick = setInterval(function () {
|
||||||
sock.send(JSON.stringify({'route': 'getUserPosition', 'tick': new Date().getTime()}));
|
sock.send(JSON.stringify({'event': 'tick', 'id': unique, 'data': {'math': Math.ceil(Math.random() * 1000000)}}));
|
||||||
}, 3000)
|
}, 3000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,51 +1,105 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
ini_set('memory_limit','64GB');
|
use wchat\common\AppConfig;
|
||||||
|
use wchat\wx\V3\Libs\TransferDetail;
|
||||||
|
use wchat\wx\V3\Libs\TransferSceneReportInfo;
|
||||||
|
use wchat\wx\V3\WxV3Transfer;
|
||||||
|
|
||||||
use Swoole\Coroutine;
|
//ini_set('memory_limit', '64G');
|
||||||
use Swoole\Coroutine\Http\Client;
|
|
||||||
use function Swoole\Coroutine\run;
|
|
||||||
|
|
||||||
function faker($page = 0)
|
$msg = 'default';
|
||||||
{
|
try {
|
||||||
$client = new Client('openapi.stupideyes.com', 443, true);
|
|
||||||
$client->get('/faker?offset=' . $page);
|
|
||||||
$client->close();
|
|
||||||
|
|
||||||
return json_decode($client->getBody(), true);
|
if (random_int(1, 10) % 3 === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg = 'default2';
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
var_dump($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
run(function () {
|
//run(function () {
|
||||||
$offset = 1;
|
// $offset = 1;
|
||||||
|
// $success = 0;
|
||||||
$success = 0;
|
//
|
||||||
for ($i = 1; $i <= 10000; $i++) {
|
// $group = new Coroutine\WaitGroup();
|
||||||
$faker = faker($offset);
|
// for ($i = 0; $i < 54500; $i++) {
|
||||||
$offset++;
|
// $offset++;
|
||||||
go(function () use ($faker, $offset, &$success) {
|
//
|
||||||
$socket = new Swoole\Coroutine\Http\Client('43.248.128.57', 14101);
|
// $group->add(1);
|
||||||
$socket->upgrade("/ws?access_token=" . $faker['params']['token']);
|
// Swoole\Coroutine::create(function () use ($offset, &$success) {
|
||||||
if ($socket->connected) {
|
// $socket = new Swoole\Coroutine\Http\Client('192.168.0.57', 14101);
|
||||||
$success += 1;
|
// $socket->upgrade("/websocket");
|
||||||
|
// if ($socket->connected) {
|
||||||
while (true) {
|
// $success += 1;
|
||||||
$socket->recv();
|
// while (true) {
|
||||||
// $socket->push('hello');
|
// $socket->recv();
|
||||||
// var_dump($socket->recv());
|
// Coroutine::sleep(0.1);
|
||||||
|
//
|
||||||
Coroutine::sleep(0.1);
|
// $socket->push("2");
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
$success -= 1;
|
// echo 'websocket fail: ' . socket_strerror($socket->errCode) . PHP_EOL;
|
||||||
|
// echo $success;
|
||||||
echo 'websocket fail: ' . socket_strerror($socket->errCode) . PHP_EOL;
|
// }
|
||||||
}
|
// # echo $offset . PHP_EOL;
|
||||||
});
|
// });
|
||||||
|
// }
|
||||||
Coroutine::sleep(0.1);
|
// $group->wait();
|
||||||
|
//});
|
||||||
var_dump($success);
|
//
|
||||||
}
|
//
|
||||||
|
//function Index_Odd()
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
});
|
//class Dispatcher
|
||||||
|
//{
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public function dispatch(){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public static function dispatch1()
|
||||||
|
// {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
//$t = microtime(true);
|
||||||
|
//var_dump(method_exists('Dispatcher', 'dispatch'));
|
||||||
|
//var_dump(method_exists('Dispatcher', 'dispatch1'));
|
||||||
|
//
|
||||||
|
//var_dump(microtime(true) - $t);
|
||||||
|
//
|
||||||
|
//$t = microtime(true);
|
||||||
|
//
|
||||||
|
//$r = new ReflectionClass('Dispatcher');
|
||||||
|
//
|
||||||
|
//var_dump($r->hasMethod('dispatch'));
|
||||||
|
//var_dump($r->hasMethod('dispatch1') && $r->getMethod('dispatch1')->isStatic());
|
||||||
|
//
|
||||||
|
//var_dump(microtime(true) - $t);
|
||||||
|
|
||||||
|
//$transferDetail = new TransferDetail();
|
||||||
|
//$transferDetail->setTransferAmount(1);
|
||||||
|
//$transferDetail->setTransferRemark("提现");
|
||||||
|
//$transferDetail->setTransferSceneId("1005");
|
||||||
|
//$transferDetail->setOpenid("xxxxx");
|
||||||
|
//$transferDetail->setNotifyUrl("https");
|
||||||
|
//$transferDetail->setOutBillNo("");
|
||||||
|
//$transferDetail->setTransferSceneReportInfos(new TransferSceneReportInfo('', ''), new TransferSceneReportInfo('', ''));
|
||||||
|
//$transferDetail->setUserName("");
|
||||||
|
//$transferDetail->setUserRecvPerception("");
|
||||||
|
//
|
||||||
|
//$transfer = new WxV3Transfer();
|
||||||
|
//$transfer->setPayConfig(AppConfig::instance((object)[]));
|
||||||
|
//$response = $transfer->transfer($transferDetail);
|
||||||
|
|||||||
Reference in New Issue
Block a user