Browse Source

disconnecte

master
hzzz 6 years ago
parent
commit
62dfc93919
  1. 11
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

11
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -1,8 +1,10 @@
package com.fr.design.mainframe.socketio;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.env.operator.socket.SocketInfoOperator;
import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
import com.fr.log.FineLoggerFactory;
@ -15,6 +17,8 @@ import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URI;
@ -54,6 +58,13 @@ public class DesignerSocketIO {
String uri = getSocketUri(current);
socketIO = Optional.of(IO.socket(new URI(uri)));
socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog);
socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
@Override
public void call(Object... objects) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
}
});
socketIO.get().connect();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

Loading…
Cancel
Save