Secured WebSocket with Helidon
Secured WebSocket (wss://…
) is to WebSocket as https
is to http
. In Helidon 2 we can enable both with the same server’s TLS configuration.
Helidon MP
You just need to tell Helidon which certificate to use to secure your https
and wss
connections.
Let’s try it out with simple endpoint.
For detailed information about setting up a WebSocket endpoint in Helidon MP, visit our docs.
Use websockat
to connect to the secured WebSocket endpoint.
$websocat -k wss://localhost:8080/ws/echo
Hi MP
Did you send Hi MP?
Note: In this example, we used a self-signed certificate hence the-k
option.
Helidon SE
The server’s TLS configuration in Helidon SE follows a similar pattern to the one we used in Helidon MP.
For detailed information about setting up a WebSocket endpoint in Helidon SE, visit our docs.
Use the same websockat
again to test it:
$websocat -k wss://localhost:8080/ws/echo
Hi SE
Did you say Hi SE?
Check out the following Helidon examples for more information: