From 457e9a0a2c928d50598c81549f846c8b117e45ec Mon Sep 17 00:00:00 2001 From: "Leo.Qin" Date: Fri, 20 Oct 2023 11:19:59 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-106402=20websocket=20cbb=20---=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E9=80=82=E9=85=8D=20=E3=80=90=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8E=9F=E5=9B=A0=E3=80=91rt=20=E3=80=90=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=E6=80=9D=E8=B7=AF=E3=80=91websocket=20cbb=20=E5=8C=85=E5=90=8D?= =?UTF-8?q?=E3=80=81=E6=96=B9=E6=B3=95=E9=80=82=E9=85=8D=20https://kms.fin?= =?UTF-8?q?eres.com/pages/viewpage.action=3FpageId=3D905125265?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../login/socketio/LoginAuthServer.java | 24 ++++++++++--------- .../server/FineEmbedServerActivator.java | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/login/socketio/LoginAuthServer.java b/designer-base/src/main/java/com/fr/design/login/socketio/LoginAuthServer.java index 2353965581..56cef8505f 100644 --- a/designer-base/src/main/java/com/fr/design/login/socketio/LoginAuthServer.java +++ b/designer-base/src/main/java/com/fr/design/login/socketio/LoginAuthServer.java @@ -1,5 +1,12 @@ package com.fr.design.login.socketio; +import com.fr.cbb.websocket.core.WebSocketAckRequest; +import com.fr.cbb.websocket.core.WebSocketClientProvider; +import com.fr.cbb.websocket.core.WebSocketConfiguration; +import com.fr.cbb.websocket.core.WebSocketServerProvider; +import com.fr.cbb.websocket.holder.EventHolder; +import com.fr.cbb.websocket.listener.AbstractDataListener; +import com.fr.cbb.websocket.core.WebSocketServerFactory; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.login.DesignerLoginType; @@ -7,11 +14,6 @@ import com.fr.design.login.bean.BBSAccountLogin; import com.fr.design.upm.event.CertificateEvent; import com.fr.event.EventDispatcher; import com.fr.log.FineLoggerFactory; -import com.fr.third.socketio.AckRequest; -import com.fr.third.socketio.Configuration; -import com.fr.third.socketio.SocketIOClient; -import com.fr.third.socketio.SocketIOServer; -import com.fr.third.socketio.listener.DataListener; import java.net.URLDecoder; import java.util.concurrent.ExecutorService; @@ -27,7 +29,7 @@ public class LoginAuthServer { private AtomicBoolean started = new AtomicBoolean(false); - private SocketIOServer server; + private WebSocketServerProvider server; private static final String HOSTNAME = "localhost"; private static final int PORT = 41925; @@ -46,10 +48,10 @@ public class LoginAuthServer { } private LoginAuthServer() { - Configuration config = new Configuration(); + WebSocketConfiguration config = new WebSocketConfiguration(); config.setHostname(HOSTNAME); config.setPort(PORT); - server = new SocketIOServer(config); + server = WebSocketServerFactory.registerWebSocketServer(config); initEventListener(); } @@ -87,9 +89,9 @@ public class LoginAuthServer { } private void initEventListener() { - server.addEventListener("bbsAccountLogin", BBSAccountLogin.class, new DataListener() { + server.addEventListener(EventHolder.build("bbsAccountLogin", BBSAccountLogin.class, new AbstractDataListener() { @Override - public void onData(SocketIOClient client, BBSAccountLogin data, AckRequest ackRequest) throws Exception { + public void onData(WebSocketClientProvider client, BBSAccountLogin data, WebSocketAckRequest ackRequest) throws Exception { // 保存登录信息到.FineReport100配置中 int uid = data.getUid(); if (uid > 0) { @@ -106,6 +108,6 @@ public class LoginAuthServer { EventDispatcher.fire(CertificateEvent.LOGIN, username); } } - }); + })); } } diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java index 13b4cdc750..8360989818 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java @@ -1,5 +1,6 @@ package com.fr.start.server; +import com.fr.cbb.websocket.core.WebSocketEndpoint; import com.fr.design.DesignerEnvManager; import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; @@ -11,7 +12,6 @@ import com.fr.startup.FineWebApplicationInitializer; import com.fr.third.guava.collect.Sets; import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import com.fr.web.socketio.WebSocketEndpoint; import com.fr.workspace.WorkContext; import org.apache.catalina.Context; import org.apache.catalina.LifecycleException;