пятница, 17 июля 2020 г.

WebSocket API in Java

Hi!

Ever wondered how many abstractions you have to learn in order to use the API?

I just started to read about websocket api in java and it seems you need a lot to understand in order be on the same wave.

Lets start with RFC 6455, then you need to read JSR-356.
You think this is enough? :-)

If you use Spring then it provides you with WebSocketConfigurer which mimicries the low level web socket api.

If you do not like to play with low level api, then you can use AbstractWebSocketMessageBrokerConfigurer which adds messaging model with queues and topics using STOMP over websocket api and fallback for the clients who do not have websocket at hand.

You can also add external message broker which will serve your messages.
But what about security?

You have to use AbstractSecurityWebSocketMessageBrokerConfigurer in order to configure security.

So, together with security this will be 5 apis\concepts you need to know just in order to play with web sockets.

Is not that much?