Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for inherited sockets #1440

Open
Cu3PO42 opened this issue Nov 13, 2024 · 1 comment · May be fixed by #1442
Open

Support for inherited sockets #1440

Cu3PO42 opened this issue Nov 13, 2024 · 1 comment · May be fixed by #1442

Comments

@Cu3PO42
Copy link

Cu3PO42 commented Nov 13, 2024

Is your feature request related to a problem? Please describe.
I would like to implement socket activation for an application using Java WebSocket, specifically Robocode Tank Royale. Socket activation lets systemd start an application on demand when others try to connect to it.

Describe the solution you'd like
Using System.inheritedChannel you can get access to a socket that was passed to the application as file descriptor 1. I'd like for there to be a constructor for WebSocketServer that, instead of taking a port and listen address, accepts a pre-existing Channel.

Describe alternatives you've considered
My specific use-case would also be solved by a constructor that calls System.inheritedChannel itself, though I believe the other one I proposed is more flexible. Socket

Socket activation is not easily replaced and there is no clean strategy to emulate it without support from the application.

Thank you for consideration!

@PhilipRoman
Copy link
Collaborator

I like this idea. From briefly looking at the code, I don't see any obstacles - if the inherited file descriptor represents a listening socket, then a ServerSocketChannel should be returned by System.inheritedChannel, which is exactly what we need.

@PhilipRoman PhilipRoman self-assigned this Nov 14, 2024
PhilipRoman added a commit that referenced this issue Nov 14, 2024
See #1440
The main motivation for this feature is the ability to integrate with
on-demand socket activation.
PhilipRoman added a commit that referenced this issue Nov 14, 2024
See #1440
The main motivation for this feature is the ability to integrate with
on-demand socket activation.
@PhilipRoman PhilipRoman linked a pull request Nov 14, 2024 that will close this issue
8 tasks
@marci4 marci4 added this to the Release 1.6.0 milestone Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants