Reputation: 99
I must write a JAVA standalone websocket client. I know that webscoket is a duplex communication protocol, but I don't know how does it exactly work. This communication is asynchronus? (like a JMS queue)
Upvotes: 0
Views: 287
Reputation: 14966
Since Websockets use an underlying TCP-Connection, all communication should be done asynchronously. This is, however, an implementation detail of your code. If you want to block your code to wait for a reply, that's up to you (though not recommended).
Websockets for Java were specified in JSR 356, so you can use them out-of-the-box in your application server. If you don't have an application server, you can use a standalone implementation like Tyrus instead.
See javax.websocket client simple example for some code samples.
Upvotes: 1