|  | @ -6,7 +6,7 @@ import org.slf4j.Logger;
 | 
	
		
			
				|  |  | import org.slf4j.LoggerFactory;
 | 
	
		
			
				|  |  | import org.springframework.stereotype.Component;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import javax.annotation.PostConstruct;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import javax.websocket.*;
 | 
	
		
			
				|  |  | import javax.websocket.server.PathParam;
 | 
	
		
			
				|  |  | import javax.websocket.server.ServerEndpoint;
 | 
	
	
		
			
				|  | @ -20,7 +20,7 @@ import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  |  * @Auther: shi kejing
 | 
	
		
			
				|  |  |  * @Date: 2021/8/20 14:20
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | @ServerEndpoint("/imserver/{userId}")
 | 
	
		
			
				|  |  | @ServerEndpoint("/")
 | 
	
		
			
				|  |  | @Component
 | 
	
		
			
				|  |  | public class WebSocketServer {
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -33,12 +33,13 @@ public class WebSocketServer {
 | 
	
		
			
				|  |  |     /**与某个客户端的连接会话,需要通过它来给客户端发送数据*/
 | 
	
		
			
				|  |  |     private Session session;
 | 
	
		
			
				|  |  |     /**接收userId*/
 | 
	
		
			
				|  |  |     private String userId="";
 | 
	
		
			
				|  |  |     private String userId="ijk";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 连接建立成功调用的方法*/
 | 
	
		
			
				|  |  |     @OnOpen
 | 
	
		
			
				|  |  |     public void onOpen(Session session,@PathParam("userId") String userId) {
 | 
	
		
			
				|  |  |         userId="ijk";
 | 
	
		
			
				|  |  |         log.info("userId = "+userId);
 | 
	
		
			
				|  |  |         this.session = session;
 | 
	
		
			
				|  |  |         this.userId=userId;
 |