Dear CXF experts,
I'm trying to connect a web client to a CXF WebSocket. The browser logs the
error "WebSocket connection failed: Error during WebSocket handshake:
Unexpected response code: XXX". The XXX response code changes depending on the
@Produces annotation: 200 when text/plain, 406 when text/*.
The server Java looks like this:
@GET
@Path("monitor")
@Produces("text/*")
public StreamingOutput greetMonitor() {
return stream -> {
stream.write("Ok".getBytes());
stream.flush();
};
}
The client Javascript looks like this:
var socket= new
WebSocket("ws://myurlwithsameportaswebservice/cxf/test/monitor");
socket.onmessage= function(e) { console.log(e.data); };
What's wrong?
Regards,
JP