diff --git a/code/VideoAccess-VCMP/api/app/lib/service/socket.js b/code/VideoAccess-VCMP/api/app/lib/service/socket.js index 9dc5d27..a78a16b 100644 --- a/code/VideoAccess-VCMP/api/app/lib/service/socket.js +++ b/code/VideoAccess-VCMP/api/app/lib/service/socket.js @@ -11,16 +11,16 @@ module.exports = async function factory (app, opts) { // 使用测试 保持链接 setInterval(async () => { - const { connected } = app.socket.sockets + const { connected } = app.socket.sockets - const roomId = 'ROOM_' + Math.random() - if (connected) { + const roomId = 'ROOM_' + Math.random() + if (connected) { for (let c in connected) { - connected[c].join(roomId) + connected[c].join(roomId) } app.socket.to(roomId).emit('TEST', { someProperty: `【星域 ROOM:${roomId}】呼叫自然选择号!!!`, }) - } + } - app.socket.emit('TEST', { someProperty: '【广播】呼叫青铜时代号!!!', }) - }, 500) + // app.socket.emit('TEST', { someProperty: '【广播】呼叫青铜时代号!!!', }) + }, 3000) } diff --git a/code/VideoAccess-VCMP/web/client/src/app.jsx b/code/VideoAccess-VCMP/web/client/src/app.jsx index 13cf884..d9ba7df 100644 --- a/code/VideoAccess-VCMP/web/client/src/app.jsx +++ b/code/VideoAccess-VCMP/web/client/src/app.jsx @@ -16,21 +16,22 @@ import application from './sections/application'; import member from './sections/member'; const App = props => { - const { projectName } = props + const { projectName } = props - useEffect(() => { - document.title = projectName; - }, []) + useEffect(() => { + document.title = projectName; + }, []) - return ( - - ) + return ( + + ) } export default App; \ No newline at end of file diff --git a/code/VideoAccess-VCMP/web/client/src/layout/actions/webSocket.js b/code/VideoAccess-VCMP/web/client/src/layout/actions/webSocket.js index 02b43c6..b0ad9de 100644 --- a/code/VideoAccess-VCMP/web/client/src/layout/actions/webSocket.js +++ b/code/VideoAccess-VCMP/web/client/src/layout/actions/webSocket.js @@ -21,30 +21,13 @@ export function initWebSocket ({ ioUrl, token }) { return dispatch => { const socket = io( - // ioUrl + ioUrl // 'http://127.0.0.1:4000' - 'ws://127.0.0.1:4000' - // '_api/' , { query: { token: token }, }); - socket.on("connect", () => { - console.log('connect'); - }); - socket.io.on("error", (error) => { - console.error(error); - }); - socket.io.on("reconnect_error", (error) => { - console.error(error); - }); - socket.io.on("reconnect_failed", () => { - console.error(error); - }); - socket.on('TEST', function (msg) { - console.info(msg); - }); dispatch({ type: INIT_WEB_SOCKET, payload: { diff --git a/code/VideoAccess-VCMP/web/client/src/layout/index.jsx b/code/VideoAccess-VCMP/web/client/src/layout/index.jsx index 0e46ec8..36cffef 100644 --- a/code/VideoAccess-VCMP/web/client/src/layout/index.jsx +++ b/code/VideoAccess-VCMP/web/client/src/layout/index.jsx @@ -84,10 +84,6 @@ const Root = props => { } } - - - - useEffect(async () => { let innerRoutes = [] let outerRoutes = [] @@ -158,7 +154,6 @@ const Root = props => { // IOT system cross window.addEventListener('message', async function (e) { // 监听 message 事件 const { data } = e - console.log(e); if (data && data.action) { if (data.action == 'initUser') { await store.dispatch(actions.auth.initAuth(data.user)) diff --git a/code/VideoAccess-VCMP/web/package.json b/code/VideoAccess-VCMP/web/package.json index 8916608..f8ea592 100644 --- a/code/VideoAccess-VCMP/web/package.json +++ b/code/VideoAccess-VCMP/web/package.json @@ -66,8 +66,8 @@ "perfect-scrollbar": "^1.5.5", "qs": "^6.10.5", "screenfull": "5.2.0", - "socket.io-client": "^4.5.0", - "socket.io-parser": "^4.2.0", + "socket.io-client": "^1.7.4", + "socket.io-parser": "^3.4.1", "superagent": "^6.1.0", "webpack": "^5.3.2", "webpack-bundle-analyzer": "^4.1.0",