Where does @serverendpoint path get mapped (Websockets)

坚强是说给别人听的谎言 提交于 2020-02-25 23:06:35

问题


I have the following @serverendpoint path for a websocket that I am using with the spring framework:

@ServerEndpoint(value="/serverendpoint", configurator = SpringConfigurator.class)
  1. My first question is say I have a website with the url www.example.com. Where does the serverendpoint with path serverendpoint get mapped? Can I access my serverendpoint at wss://example.com:$PORT/currentpage.html/serverendpoint? Or is this the wrong way.
  2. I have a Wildfly 10 server running. Based on another SO question, I was told to use the following Uri: var wsUri = "wss://" + document.location.hostname + ":8443" + document.location.pathname + "/../serverendpoint";. However, when I do so, in Google Chrome, I receive the following error:

WebSocket is already in CLOSING or CLOSED state.

My console.log prints that the websocket has been connected, but then I immediately get the above error. What am I doing wrong?

As per the Wildfly server log, I know the serverendpoint was mapped:

[io.undertow.websockets.jsr] (ServerService Thread Pool -- 78) UT026003: Adding annotated server endpoint class com.voice2.spring.web.controller.serverendpoint for path /serverendpoint

So how do I connect to this sever endpoint?

Here is my project file hierarchy:

来源:https://stackoverflow.com/questions/39112243/where-does-serverendpoint-path-get-mapped-websockets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!