The websocket inferface doesn't generate the doc, but the other controller is ok? why #898
-
The websocket inferface doesn't generate the doc, but the other controller is ok? why @slf4j
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
In WebSocket programming, it's common to handle URL parameters within the @ServerEndpoint("/documents/did/{did}/bid/{bid}")
@RestController
public class DocumentWebSocketController {
private int documentId;
private String branchBid;
/**
* Handles the opening of a WebSocket connection.
*
* @param session the WebSocket session
* @param documentId the ID of the document
* @param branchBid the ID of the branch
*/
@OnOpen
public void onOpen(Session session, @PathParam("did") int documentId,
@PathParam("bid") String branchBid) {
this.documentId = documentId;
this.branchBid = branchBid;
}
@OnMessage
public void receive(String message, Session session) {
// You can now use documentId and branchBid here
// Example usage:
System.out.println("Received message: " + message + " for Document ID: " + documentId + " and Branch ID: " + branchBid);
}
@OnClose
public void onClose(Session session) {
// Handle close event
}
} By defining the parameters in the You can refer to this example: |
Beta Was this translation helpful? Give feedback.
-
@skydream-xu First, upgrade to the latest version 3.0.7. Then make sure you are using the correct commands. The WebSocket and Restful interfaces currently use different execution commands. To generate the WebSocket interface, use commands like Additionally, if you used |
Beta Was this translation helpful? Give feedback.
@skydream-xu First, upgrade to the latest version 3.0.7. Then make sure you are using the correct commands. The WebSocket and Restful interfaces currently use different execution commands. To generate the WebSocket interface, use commands like
mvn smart-doc:websocket-markdown
,mvn smart-doc:websocket-html
, etc.Additionally, if you used
packageFilters
, please check if it's becausepackageFilters
filtered them out. If you can't find the reason after checking everything, you can debug to find the cause. For debugging, you can refer to the official guide at https://smart-doc-group.github.io/guide/plugins/maven#plug-in-debugging.