【java】websocket接口接收多个请求参数

@Controller
@ServerEndpoint("/test/{appKey}")
public class WebSocketServer {
	@OnOpen
    public void onOpen(Session session, @PathParam(value="param0") String param0) {
        Map<String, String> paramMap = session.getPathParameters();
        if(paramMap.containsKey("param1")){
           	System.out.println(paramMap.get("param1"))
        }
        if(paramMap.containsKey("param2")){
           	System.out.println(paramMap.get("param2"))
        }
    }
}

你可能感兴趣的:(java,java)