Merged
Conversation
See #1440 The main motivation for this feature is the ability to integrate with on-demand socket activation.
|
Thanks so much for working on this! I was able to use this branch to successfully implement support for inherited sockets in Robocode Tank Royale, as I described in #1440. See robocode-dev/tank-royale#115 for my PR there. |
Collaborator
|
@PhilipRoman feel free to ping me when you are done |
Collaborator
Author
|
@marci4 If you are ok with merging this without unit test (or have time to implement it yourself), please go ahead. I am very busy and don't have any time to invest. As I described, I did a manual test with systemd and it works fine. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for socket activation
Description
Added new constructor to WebSocketServer which takes an already prepared Channel.
If this constructor is used, then WebSocketServer will not try to open it's own channel, or bind it since it is expected to be handled by user.
This allows to use System.inheritedChannel() together with systemd socket activation, which passes the prepared socket as file descriptor #0.
Also added an example "smart" chat server, which will be brought up and down on-demand by systemd.
I have tested it and it is working as expected.
TODO: a unit test should be added which creates server with an existing Channel.
I am also considering adding a script for running an integration test in a container, to make sure socket activation works as expected with this feature.
Related Issue
Fixes #1440
Motivation and Context
Allows to use socket activation with websockets
How Has This Been Tested?
I ran the new example which is in
src/main/exampleas a systemd unit. Server comes up and down as expected.Types of changes
Checklist: