0

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)

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
Károly Neue
  • 89
  • 2
  • 9

1 Answers1

1

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.

Leviathan
  • 2,468
  • 1
  • 18
  • 24