e
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Protocol\Message;
|
namespace Http\Message;
|
||||||
|
|
||||||
use JetBrains\PhpStorm\Pure;
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Kiri\Core\Xml;
|
use Kiri\Core\Xml;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Protocol\Message;
|
namespace Http\Message;
|
||||||
|
|
||||||
use Kiri\Core\Xml;
|
use Kiri\Core\Xml;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Protocol\Message;
|
namespace Http\Message;
|
||||||
|
|
||||||
use BadMethodCallException;
|
use BadMethodCallException;
|
||||||
use Http\IInterface\AuthIdentity;
|
use Http\IInterface\AuthIdentity;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Protocol\Message;
|
namespace Http\Message;
|
||||||
|
|
||||||
use JetBrains\PhpStorm\Pure;
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Protocol\Message;
|
namespace Http\Message;
|
||||||
|
|
||||||
use Http\Context\Context;
|
use Http\Context\Context;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Protocol\Message;
|
namespace Http\Message;
|
||||||
|
|
||||||
use JetBrains\PhpStorm\ArrayShape;
|
use JetBrains\PhpStorm\ArrayShape;
|
||||||
use Psr\Http\Message\StreamInterface;
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Protocol\Message;
|
namespace Http\Message;
|
||||||
|
|
||||||
use Psr\Http\Message\StreamInterface;
|
use Psr\Http\Message\StreamInterface;
|
||||||
use Psr\Http\Message\UploadedFileInterface;
|
use Psr\Http\Message\UploadedFileInterface;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Protocol\Message;
|
namespace Http\Message;
|
||||||
|
|
||||||
use Psr\Http\Message\UriInterface;
|
use Psr\Http\Message\UriInterface;
|
||||||
use Swoole\Http\Request;
|
use Swoole\Http\Request;
|
||||||
|
|||||||
+23
-11
@@ -12,21 +12,30 @@
|
|||||||
</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>
|
||||||
<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');
|
||||||
|
|
||||||
console.log(new Date().getTime());
|
|
||||||
console.log(Date.parse(new Date()));
|
let buffer;
|
||||||
|
let ms = new MediaSource()
|
||||||
|
let output = document.getElementById('output')
|
||||||
|
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');
|
// let div = document.createElement('div');
|
||||||
div.innerHTML = message.data;
|
// 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.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';
|
// div.style.marginBottom = '10px';
|
||||||
let count = format.getElementsByTagName('div');
|
// let count = format.getElementsByTagName('div');
|
||||||
|
|
||||||
format.insertBefore(div, count[0]);
|
buffer.appendBuffer(new Uint8Array(message.data))
|
||||||
|
|
||||||
|
// format.insertBefore(div, count[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(even) {
|
function close(even) {
|
||||||
@@ -39,22 +48,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function connect() {
|
function connect() {
|
||||||
sock = new WebSocket('ws://47.92.194.207:9528/socket?auth='+encodeURIComponent('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJhcHBsaWNhdGlvbjFfNjEwMzc2ZTU2MTRhMTkuNTk0ODM5NzEiLCJpYXQiOjE2Mjc2MTY5OTcsIm5iZiI6MTYyNzYxNjk5NywiZXhwIjoxODg2ODE2OTk3LCJ1aWQiOjUxMCwibmlja25hbWUiOiJvcGVuaWQiLCJqd3Rfc2NlbmUiOiJhcHBsaWNhdGlvbjEifQ.B7zqH0WJklZVN0acER3tmc9S08WoK-aucJ1MghnunuE'),
|
sock = new WebSocket('ws://47.92.194.207:9528/');
|
||||||
['test', 'asdasdkjfgghdfgjdfgdfg12343', 'm-chat']);
|
|
||||||
sock.onopen = function () {
|
sock.onopen = function () {
|
||||||
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({'route': 'getUserPosition', 'tick': new Date().getTime()}));
|
||||||
// sock.close(4000);
|
|
||||||
}, 3000)
|
}, 3000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
connect();
|
connect();
|
||||||
sock.onmessage = message;
|
sock.onmessage = message;
|
||||||
sock.onclose = close;
|
sock.onclose = close;
|
||||||
|
|
||||||
|
// console.log(window);
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user