-
The
javax.websocket.server
package contains annotations, classes, and interfaces to create and configure server endpoints. -
The
javax.websocket
package contains annotations, classes, interfaces, and exceptions that are common to client and server endpoints.
Note: In most cases, it is easier to create and deploy an annotated endpoint than a programmatic endpoint. This chapter provides a simple example of a programmatic endpoint, but it focuses on annotated endpoints. |
Note: As opposed to servlets, WebSocket endpoints are instantiated multiple times. The container creates an instance of an endpoint per connection to its deployment URI. Each instance is associated with one and only one connection. This facilitates keeping user state for each connection and makes development easier, because there is only one thread executing the code of an endpoint instance at any given time. |