WebSocket Server#14817
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||
PR Code Suggestions ✨Latest suggestions up to 8a8db97
Previous suggestions✅ Suggestions up to commit 395db73
|
||||||||||||||||||||||||||
| String argument = extractJsonValue(message, "argument"); | ||
|
|
||
| LOGGER.debug("Processing command: {} with argument: {}", command, argument); | ||
|
|
There was a problem hiding this comment.
Suggestion: Add null check for command
| if (command == null) { | |
| return "{\"status\":\"error\",\"message\":\"Command not specified\"}"; | |
| } | |
|
You committed your code on the For this pull request, this is OK. For subsequent pull requests, please start with a different branch with a proper branch name. See CONTRIBUTING.md for more details. |
|
Happy New Year! Nice to hear from you again! |
|
Note that your PR will not be reviewed/accepted until you have gone through the mandatory checks in the description and marked each of them them exactly in the format of |
|
Hi @Siedlerchr! Happy new year! I don't think the http server can be used as is, as most of what the websocket one does is deal with the handshake and data format. I'm no expert however, so I might be wrong. Currently on Chrome the sample addon works. It is also built on the zotero translators. EDIT: Actually it might be possible... I'll give it a closer look |
|
https://github.com/LyzardKing/jabref/tree/websocket Here is the version that reuses the http server. I added a few libraries here and there (grizzly-websockets and jakarta.servlet-api), and add an overloaded run function to Server so it would accept the remoteMessageHandler. Still needs testing, but it interfaces correclty with the extension. I'll close this PR and open a new one. |
|
Replaced by #14823 |
User description
This PR adds a websocket for remote communication. Specifically to link with browsers (replacing the problematic native messaging).
A prototype extension is available at: https://github.com/LyzardKing/JabRef-Connector
Updating the old one required too many changes, so the new version exists (for now).
It works (I'm running it from the repo myself), but any opinions and comments are more than welcome.
Steps to test
Running Jabref, in the General Settings page -> Single Instance -> Enable WebSocket Server ...
The default port is 23116 in both JabRef and the extension (no reason, can be changed).
The md file shows how to quickly test it from a script. I added a simple unit test.
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)PR Type
Enhancement
Description
Adds WebSocket server for browser extension communication
Implements RFC 6455 WebSocket protocol with JSON message handling
Adds GUI settings to enable/disable WebSocket server and configure port
Supports commands: ping, focus, open, and add BibTeX entries
Diagram Walkthrough
File Walkthrough
8 files
WebSocket server implementation with RFC 6455 protocolThread wrapper for WebSocket server lifecycle managementAdd WebSocket server management methods and lifecycleAdd WebSocket port and enable properties with accessorsAdd WebSocket server property bindings and validationAdd WebSocket server checkbox and port field to UIAdd WebSocket server UI controls to preferences layoutStart WebSocket server during application initialization1 files
Add WebSocket port and enable settings to preferences2 files
Add English localization for WebSocket server settingAdd WebSocket server documentation with examples2 files
Update test to include WebSocket port parametersAdd comprehensive WebSocket server unit tests