|
@@ -1,13 +1,18 @@
|
|
|
package com.ym.mec.web.support.socket;
|
|
|
|
|
|
import com.corundumstudio.socketio.SocketIOServer;
|
|
|
+import com.corundumstudio.socketio.namespace.Namespace;
|
|
|
import com.corundumstudio.socketio.namespace.NamespacesHub;
|
|
|
+import com.corundumstudio.socketio.store.pubsub.DispatchMessage;
|
|
|
import com.corundumstudio.socketio.store.pubsub.PubSubStore;
|
|
|
+import com.corundumstudio.socketio.store.pubsub.PubSubType;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
public class ServerRunner implements CommandLineRunner {
|
|
@@ -30,7 +35,7 @@ public class ServerRunner implements CommandLineRunner {
|
|
|
server.start();
|
|
|
|
|
|
// 订阅消息
|
|
|
- /*pubSubStore.subscribe(PubSubType.DISPATCH, message -> {
|
|
|
+ pubSubStore.subscribe(PubSubType.DISPATCH, message -> {
|
|
|
|
|
|
// 分布式服务空间请求分发
|
|
|
Namespace namespace = namespacesHub.get(message.getNamespace());
|
|
@@ -39,7 +44,7 @@ public class ServerRunner implements CommandLineRunner {
|
|
|
namespace.dispatch(message.getRoom(), message.getPacket());
|
|
|
}
|
|
|
|
|
|
- }, DispatchMessage.class);*/
|
|
|
+ }, DispatchMessage.class);
|
|
|
|
|
|
log.info("--------SocketIO------- SERVER.START PORT={}", server.getConfiguration().getPort());
|
|
|
}
|