0
nodejs socket.io는 모든 모듈에 대해 단일 소켓 연결을 사용합니다. 이는 java websocket 구현에 적용됩니까? 예를JAVA EE 7 WebSocket 구현
에 대한
내가 여러 ServerEndPoints가
@ServerEndpoint("/ws1")
public class Socket1 {}
@ServerEndpoint("/ws2")
public class Socket2 {}
@ServerEndpoint("/ws3")
public class Socket3 {}
단일 소켓 연결이 그들 모두를 처리하는 데 사용됩니다해야?
또는 sholud 내가 하나의 ServerEndpoint를 사용하여 내 메시지 유형에 따라 작업을 수행 같은
난 단지보기의 순수한 개인적인 관점에서, 두 가지가 들어오는 메시지입니다 처리를위한 제안 말할 수@ServerEndpoint(value = "/ws",
encoders = CommandEncoder.class,
decoders = CommandDecoder.class)
public class Socket {
@OnMessage
public void onMessage(Command message, Session session){
switch(message.type){
case SomeAction:dosomething(message,session);break;
case AnotherAction:doAnotherThing(message,session);break;
}
}
}