0

I need some idea to start a small task. Basically, I want to create a single WebSocket client and server in which server send multiple requests to the client and then client process these request and reply it back. I am using a Jetty API for both server and client side. Basically from server sending these request would be synchronized but multi-threaded means server send can send multiple requests in the same time but also wait for the request that client answer of each. This single client always connects with a server and process server requests. This is basically reverse request/response architecture in web socket point of view. I am not getting this how a client side distinguishes these multiple requests which come from the server and how a server side waits for each of these but not block overall sending process. Do I need multithreading both server and client side? Can someone give me any idea of this?

Arghavan
  • 1,125
  • 1
  • 11
  • 17

1 Answers1

0

Jetty API helps you don't think a lot about multithreading, you should write just some callback methods like OnWebSocketConnect, OnWebSocketClose, OnWebSocketMessage and OnWebSocketError. This article has good explanation and examples: https://examples.javacodegeeks.com/enterprise-java/jetty/jetty-websocket-example/