Skip to content
Mihail Kuznetsov edited this page Jul 8, 2015 · 12 revisions

How to make REST calls through WebSocket:

  • First, ensure there are ServerContainerInitializeListener and WSConnectionTracker listeners declared in web.xml
    <listener>
        <listener-class>org.everrest.websockets.ServerContainerInitializeListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.everrest.websockets.WSConnectionTracker</listener-class>
    </listener>
  • When the application is deployed, try any WebSocket client (for example Advanced REST Client) and connect to ws://localhost:8080/book-service/ws:

  • Now, when connection has been succesfully established, it is possible to send and receive messages through WebSocket. For example, send following message:

{"method":"GET","path":"/books", "uuid":"1"}

As result, you should see two response messages: