Websockets support?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
The issue names no repository files or tests; its concrete entry-point reference is Javalin's ApiBuilder, alongside Spring and Helidon websocket examples. Start by reviewing the existing controller and server integration, then determine whether the project should add websocket support or a separate library. Done criteria are not defined in the issue.
Written by the indexing model from the issue text.
Description
Could we see some kind of websocket support here or in a seperate avaje-sockets library? It would be nice to be able to have a Spring-like system for them too, in a glimpse I see this guide from Spring with the following sample:
(...)
@Controller
public class GreetingController {
@MessageMapping("/hello")
@SendTo("/topic/greetings")
public Greeting greeting(HelloMessage message) throws Exception {
Thread.sleep(1000); // simulated delay
return new Greeting("Hello, " + HtmlUtils.htmlEscape(message.getName()) + "!");
}
}
This controller is concise and simple, but plenty is going on. We break it down step by step.
The @MessageMapping annotation ensures that, if a message is sent to the /hello destination, the greeting() method is called.
The payload of the message is bound to a HelloMessage object, which is passed into greeting().
Internally, the implementation of the method simulates a processing delay by causing the thread to sleep for one second. This is to demonstrate that, after the client sends a message, the server can take as long as it needs to asynchronously process the message. The client can continue with whatever work it needs to do without waiting for the response.
After the one-second delay, the greeting() method creates a Greeting object and returns it. The return value is broadcast to all subscribers of /topic/greetings, as specified in the @SendTo annotation. Note that the name from the input message is sanitized, since, in this case, it will be echoed back and re-rendered in the browser DOM on the client side.
This is a pretty beautiful system, but obviously as all things Spring is bloated, and Javalin (and Heildon actually, I've personally zero experience with Heildon so I'm probably stating things you're already aware of) already provides support for websockets.
Javalin has websocket registration right inside of ApiBuilder and I imagine Heildon has a simple system to do so as well, so it shouldn't be too much work to get this to work.
- Dominant language
- Java
- Stars
- 99
- Forks
- 19
- Avg merge
- 14h 26m
- Merged PRs (30d)
- 12
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from avaje/avaje-http
-
Difficulty 2/5 1-3 hours Newbie friendliness 25/100
avaje/avaje-http#739 · 1 comment ·
Maintainers usually reply within 1 day
-
non-reproducible -sources.jarMay be free again @rbygrave claimed this 423 days ago, and no pull request is open. Open
avaje/avaje-http#650 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
-
Create a BOM?Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
avaje/avaje-http#646 ·
Maintainers usually reply within 1 day
All issues in avaje/avaje-http
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
avaje/avaje-metrics#142 ·
-
As a developer using gamma, I would like a click-to-copy button for the client credentials, so it is easier to copy themPossibly taken @Portals claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Lincoln-cn/JAiRouter#1473 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
exercism/java-analyzer#379 ·