WebSocket: Generic WebSocket Endpoint Templates
Description:
It would be beneficial to users if LSP4Jakarta could create a generic endpoint. There are programmatic and annotated variations.
Annotated Server:
@ServerEndpoint("/hello");
public class ServerEndpoint {
@OnOpen
public void onOpen(Session session) throws IOException {
// TODO
}
@OnMessage
public void onMessage(Session session, Message message) throws IOException {
// TODO
}
@OnClose
public void onClose(Session session) throws IOException {
// TODO
}
@OnError
public void onError(Session session, Throwable throwable) {
// TODO
}
}
Annotated Client:
@ClientEndpoint
public class ClientEndPoint {
@OnOpen
public void onOpen(Session session) throws IOException {
// TODO
}
@OnMessage
public void onMessage(Session session, Message message) throws IOException {
// TODO
}
@OnClose
public void onClose(Session session) throws IOException {
// TODO
}
@OnError
public void onError(Session session, Throwable throwable) {
// TODO
}
}
Programmatic (For both Client & Server)
public class ProgrammaticEndpoint extends Endpoint {
@Override
public void onOpen(Session session, EndpointConfig config) {
//TODO
}
@Override
public void onClose(Session session, CloseReason closeReason) {
// TODO
}
@Override
public void onError(Session session, Throwable error) {
// TODO
}
}
Note: Another Potential Snippet could be the following. The MessageHandler can differ however between MessageHandler.Whole and MessageHandler.Partial (along with the generic). This snippet would be typically used in the programmatic on open call.
session.addMessageHandler(new MessageHandler.Whole<String>() {
@Override
public void onMessage(String message) {
//TODO
}
});
Specification:
Quote and link to specification where this feature request came from
https://jakarta.ee/specifications/websocket/2.1/apidocs/server/jakarta/websocket/server/serverendpoint
https://jakarta.ee/specifications/websocket/2.1/apidocs/client/jakarta/websocket/clientendpoint
Client: https://jakarta.ee/specifications/websocket/2.1/apidocs/client/jakarta/websocket/endpoint
Endpoint (same as above): https://jakarta.ee/specifications/websocket/2.1/apidocs/server/jakarta/websocket/endpoint
Type of language feature proposed:
Select all that apply
- [ ] diagnostic
- [ ] quick-fix
- [x] snippet
- [ ] other, please specify:
Link to the bugzilla issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=579498
I just added a comment there describing the patch proposal
The version in the Manifest needs to be updated.
16:42:27.335 [ERROR] Failed to execute goal org.eclipse.tycho.extras:tycho-p2-extras-plugin:3.0.0-SNAPSHOT:compare-version-with-baselines (compare-attached-artifacts-with-release) on project org.eclipse.ui.ide: Only qualifier changed for (org.eclipse.ui.ide/3.19.0.v20220610-1747). Expected to have bigger x.y.z than what is available in baseline (3.19.0.v20220511-1638) -> [Help 1]
- I do not understand the issue - could you provide screenshots before/after?
- new files need a copyright in the header
- please avoid newline changes.
API
Are there guidelines somewhere on what the version should be ?
Should I change from Bundle-Version: 3.19.0.qualifier to Bundle-Version: 3.19.1.qualifier
Bundle-Version: 3.19.1.qualifier
we increase by 100. see https://wiki.eclipse.org/Version_Numbering#When_to_change_the_service_segment 3.19.100
Bundle-Version: 3.19.1.qualifier
we increase by 100. see https://wiki.eclipse.org/Version_Numbering#When_to_change_the_service_segment 3.19.100
Reading the wiki its still not clear if it should be a minor change or a service change. The extension point has changed so I thought maybe it should be minor. However if I increase minor to 3.20.0 I get an error from API Analysis in eclipse saying there is no API change.
Reading the wiki its still not clear if it should be a minor change or a service change. The extension point has changed so I thought maybe it should be minor. However if I increase minor to 3.20.0 I get an error from API Analysis in eclipse saying there is no API change.
It's not a binary break that the API Analysis detects. However it is an API change. Some guru can force an increase to 3.20 but let's wait if others agree about that change.
Test Results
1 818 files + 3 1 818 suites +3 1h 41m 29s :stopwatch: + 3m 33s 7 708 tests + 4 7 480 :white_check_mark: + 5 228 :zzz: ±0 0 :x: - 1 24 285 runs +12 23 538 :white_check_mark: +13 747 :zzz: ±0 0 :x: - 1
Results for commit 7401cf79. ± Comparison against base commit a431d71a.
:recycle: This comment has been updated with latest results.