WebSocketStompClient won't connect to SockJS endpoint

后端 未结 3 1166
心在旅途
心在旅途 2021-02-04 10:10

I\'m playing around with the new (as of version 4.2) java STOMP client support. My starting point is the getting started guide (Using WebSocket to build an interactive web appl

3条回答
  •  时光取名叫无心
    2021-02-04 10:49

    As stated in the reference documentation: when enabling SockJS, multiple transports are configured for you. First, the client sends a "GET /info" request to know about supported transports and then sends a request depending on its capabilities:

    "http://host:port/myApp/myEndpoint/{server-id}/{session-id}/{transport}"
    

    Now you don't need to duplicate your configuration for you "/hello" endpoint. You'd rather directly use the websocket endpoint, or better, use the Java SockJS client with a websocket transport. See the complete example in the reference documentation.

提交回复
热议问题