ws://host:port/cms/ocpp/CBNO7
`import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import javax.ws.rs.PathParam;
@ServerEndpoint("/ocpp")
public class OcppWebsocketServer {
@OnOpen
public void onOpen(Session session) throws IOException {
System.out.println(session.getId() + " has opened a connection");
try {
session.getBasicRemote().sendText("Connection Established");
} catch (IOException ex) {
ex.printStackTrace();
}
}
@OnMessage
public void onMessage(String message, Session session) {
System.out.println("Message from " + session.getId() + ": " + message);
}
@OnError
public void onError(Throwable error) {
System.out.println("error = " + error);
Logger.getLogger(OcppWebsocketServer.class.getName()).log(Level.SEVERE, null, error);
}
@OnClose
public void onClose(Session session) {
System.out.println("Session " + session.getId() + " has ended");
}
}`
如何在端点处获取CBNO7