Unable to establish the secure connection on websocket

The scenario is, I have an application which is built using AngularJS which is live on a server in my premises. Now I have one finger print scanner device at the client side which is again in my premises. The application and devices are communicating via websocket.

I have generated a self signed certificate through Java keytool and imported in browser’s trusted root certification authorities. But I am unable to make the communication. This error is thrown in the console :

failed: Error in connection establishment: net::ERR_INSECURE_RESPONSE

I have followed this link and also followed this thread but still problem is not resolved. I am using updated browsers and I am testing it on Chrome and Firefox.

Locally the application is working fine with ws.

How can I make a secure connection via websocket in my application ?
What else points do I need to keep in mind while making a secure connection on websocket ?

Note: To establish the secure connection I am using wss.
EDIT :

$scope.entry.alert = {}
        var protocol = $location.protocol() == 'http' ? 'ws' : 'wss';
        var url = protocol+"://"+"127.0.0.1"+":"+port_no+"/XXXX/XXXX/XXXX"
        var socket = $scope.socket = $websocket(url);
        socket.onMessage(function(response){
          var respData = response.data;
          //console.log(respData)
          if(respData == "_CONNECTED_"){
            return
          }
          try{
            respData = JSON.parse(respData)
          }catch(err){
            return
          }
          if(respData.completionstatus == true){
            $scope.entry.alert = {success : true,message : respData.message};
            return
          }
          if(respData.status == 200){
            $scope.entry.alert = {success : true,message :respData.message};
          }
          if(respData.status!=200){
            $scope.entry.alert = {error : true,message : respData.message};
          }
          socket.close()
        });

I am using vertx to make a websocket connection

if(SSL) {
            String certPath = "./data/selfsigned.jks";
            options.setKeyStoreOptions(new JksOptions().setPassword("XXXX").setPath(certPath));
            options.setSsl(true);
            logger.info("Starting the SSL Socket");
        }
        HttpServer server = vertx.createHttpServer(options);
        if(MODE.equals("XXXXX")) {
            startFingerprintListener(vertx);
        }

        server.websocketHandler(websocket->{
            logger.info("Request Recevied::"+websocket.path());
            if(!websocket.path().equals("/XXXX/XXXX/XXXX")  && !websocket.path().equals("/XXXX/XXXX/XXXX")) {
                String error = "Invalid Request "+websocket.path();
                JsonObject respJson = new JsonObject();
                respJson.put("status",500);
                respJson.put("message",error);
                websocket.writeFinalTextFrame(respJson.toString());
                websocket.close();
                return;
            }
            });

Source: AngularJS