Creating WebSocket endpoints

You can use wizards to create WebSocket endpoints in your workspace.

Before you begin

.
  • You can use the wizard to create the following endpoint types on Web/Web Fragment 3.1, or later, and Utility projects:
    • Programmatic endpoint. Creating an endpoint with this option generates a new class, which extends the javax.WebSocket.Endpoint class and the onClose, onOpen, onError method stubs that you select.
    • Annotated client endpoint. Choosing this option generates a new class that is annotated with the @ClientEndpoint annotation.
    • Annotated server endpoint. You must specify the mandatory URL to complete the wizard. Choosing this option generates a new class that is annotated with the @ServerEndpoint annotation.

Procedure

  1. Create a Web, Web Fragment, or Utility project.
  2. Create a WebSocket Endpoint by using the file or context menu options:
    • Click File > New > Other. Under the Web category, select WebSocket Endpoint.
    • Right-click a selected project. Select New > WebSocket Endpoint.