How Tomcat 8 Handles websocket upgrade request

后端 未结 2 1374
傲寒
傲寒 2021-01-26 01:46

I want to understand handling of websocket upgrade request in tomcat ? Is it done via filters or servlets ? How the ws upgrade request is handled by TOmcat-8.

Thanks,

2条回答
  •  梦谈多话
    2021-01-26 02:08

    WebSockets are a completely different protocol. They are not handled by filters or servlets but instead by EndPoints. To create them you use to extend the endpoint class but, like everything else in Java EE, you can now use annotations. For more info check out the latest doc Java API for WebSockets

    To create them on the client side the request starts in HTTP, perhaps in JavaScript, but on Tomcat the endpoint is listening, not your normal servlets.

提交回复
热议问题