0

I don't want to use a full Web Server like Apache Tomcat or any similar technology. I just need to provide a websocket server in my desktop app and allow a web page to connect to it, in the same machine, that's it.

I've been using TooTallNate library and everything is fine, but the problem comes when I try to communicate javascript using the HTTPS protocol, the error is something about:

Mixed Content: The page at 'https://localhost/projects/websocket/test/test.html#' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://localhost:38521'. This request has been blocked; this endpoint must be available over WSS. Uncaught SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.

The big problem comes when from a HTTPS page I try to establish communication to my Java desktop app. Because in that library there is not good and enough SSL/TLS support to solve this.

So, I need a minimal or clean library in Java to create a websocket server (with TLS support) and allow the communication of a web page via HTTPS and via HTTP.

I heard something about jetty. What do you think?

Jordy Baylac
  • 510
  • 6
  • 18
  • 1
    Not jetty; that's a Tomcat equivalent. I'd recommend netty. – duffymo Aug 23 '16 at 17:28
  • Thanks, but have you seen something related to websockets in netty? – Jordy Baylac Aug 23 '16 at 17:28
  • 1
    http://netty.io/news/2011/11/17/websockets.html – duffymo Aug 23 '16 at 17:29
  • 1
    Try this post if you like Sun httpserver http://stackoverflow.com/questions/1186328/embedded-http-server-in-swing-java-app I would also look into Jersey and Jetty. –  Aug 23 '16 at 17:30
  • 1
    Your security error has nothing to do with your server at all. This is browser issue and has something to with security and probably cross domain origins and perhaps limitations of what you can do from a page loaded via a `file://` URL. You need to fix those issues, not change your server. – jfriend00 Aug 23 '16 at 18:04
  • it was tested online, the error is the same with the file protocol – Jordy Baylac Aug 23 '16 at 18:21

0 Answers0