zoom : socket.io - admin-ui

This commit is contained in:
haerong22
2021-10-16 20:54:34 +09:00
parent 4f81534b0a
commit 1c58883fcd
3 changed files with 864 additions and 68 deletions

917
zoom/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,7 @@
"nodemon": "^2.0.13"
},
"dependencies": {
"@socket.io/admin-ui": "^0.2.0",
"express": "^4.17.1",
"pug": "^3.0.2",
"socket.io": "^4.3.0",

View File

@@ -1,5 +1,6 @@
import http from "http";
import SocketIo from "socket.io";
import { Server } from "socket.io";
import { instrument } from "@socket.io/admin-ui";
import express, { application } from "express";
const app = express();
@@ -14,7 +15,16 @@ app.get("/*", (req, res) => res.redirect("/"));
const handleListen = () => console.log(`Listening on http://localhost:3000`);
const httpServer = http.createServer(app);
const wsServer = SocketIo(httpServer);
const wsServer = new Server(httpServer, {
cors: {
origin: ["https://admin.socket.io"],
credentials: true,
},
});
instrument(wsServer, {
auth: false,
});
function publicRooms() {
const {sockets: {adapter: {sids, rooms}}} = wsServer;