问题
I have the following @serverendpoint path for a websocket that I am using with the spring framework:
@ServerEndpoint(value="/serverendpoint", configurator = SpringConfigurator.class)
- 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 atwss://example.com:$PORT/currentpage.html/serverendpoint
? Or is this the wrong way. - 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