[+] 完善socket信令

This commit is contained in:
acgist
2023-02-14 08:14:23 +08:00
parent 78fa48c35c
commit 778b933000
59 changed files with 751 additions and 679 deletions

View File

@@ -9,6 +9,7 @@ module.exports = {
version: "1.0.0",
// 交互式命令行
command: true,
welcome: `${__dirname}/index.html`,
// 日志级别
logLevel: "DEBUG",
// 信令服务
@@ -144,19 +145,4 @@ module.exports = {
maxSctpMessageSize: 262144,
},
},
wellcome: `<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>桃夭媒体服务</title>
<style type="text/css">
p{text-align:center;}
a{text-decoration:none;}
</style>
</head>
<body>
<p><a href="https://gitee.com/acgist/taoyao">taoyao-media-server</a></p>
<p><a href="https://www.acgist.com">acgist</a></p>
</body>
</html>`,
};

View File

@@ -3,7 +3,7 @@
const fs = require("fs");
const ws = require("ws");
const https = require("https");
const mediasoup = require("mediasoup");
// const mediasoup = require("mediasoup");
const config = require("./Config");
const Logger = require("./Logger");
const Signal = require("./Signal");
@@ -80,7 +80,7 @@ async function buildSignalServer() {
// 配置HTTPS
httpsServer = https.createServer(tls, (request, response) => {
response.writeHead(200);
response.end(config.wellcome);
response.end(fs.readFileSync(config.welcome));
});
// 配置WebSocket
webSocketServer = new ws.Server({ server: httpsServer });
@@ -176,9 +176,12 @@ async function buildCommandConsole() {
* 启动方法
*/
async function main() {
logger.debug("DEBUG").info("INFO").warn("WARN").error("ERROR");
logger.debug("闹市早行客");
logger.info("江边独钓翁");
logger.warn("山中与谁同");
logger.error("绿竹细雨风");
logger.info("开始启动", config.name);
await buildMediasoupWorkers();
// await buildMediasoupWorkers();
await buildSignalServer();
await buildClientInterval();
await buildCommandConsole();

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>桃夭媒体服务</title>
<style type="text/css">
p{text-align:center;}
a{text-decoration:none;}
</style>
</head>
<body>
<p><a href="https://gitee.com/acgist/taoyao">taoyao-media-server</a></p>
<p><a href="https://www.acgist.com">acgist</a></p>
</body>
</html>