I use GF 4 as JavaEE server.
This is how I understand servlet processing: There is a pool of threads and when request comes one thread from this pool is taken to process the request. After that the thread is put back to pool.
Based on the information above I suppose (I am not sure) that websockets (server end points) are processed this way: There is pool of threads, when
- Client creates new websocket a thread is taken from pool to create new instance of ServerEndpoint and to execute @OnOpen method. After that thread is put back to pool.
- Client sends message over websocket to server. Thread is taken from pool to execute @OnMessage method. After that thread is put back to pool.
- Client closes the websocket - thread is taken from pool to execute @OnClose method. After that thread is put back to pool.
It all means that every method of ServerEndpoint can be executed by different threads. Is my understanding right?