2017-11-04 3 views

답변

0

1 단계는 서버에서 hello 이벤트를 내보내는 것입니다.

io.on("connection",(socket)=>{ 
    //every time a new socket (connection made it will emit the hello) 
     socket.emit("hello",{type:"hello"}); 
    // 
}); 

2 번째 단계는 백그라운드 서비스

mSocket.on("hello", new Emitter.Listener() { 
      @Override 
      public void call(Object... args) { 
      //here try to put all your available rooms in the object 
       mSocket.emit("join", object); 
      } 
});  

에서 클라이언트에서이 이벤트를 등록하고 이제 다시 연결의 클라이언트가 수행해야 할 모든 작업이 내부를 구현하는 것입니다 안녕하세요.이 예제는 고객에게 사용 가능한 전화 번호로 가입하는 것입니다 ...