ESXi

 View Only
  • 1.  Issue with WebSocket Connection to HTML Console in VMware

    Posted Dec 12, 2023 09:39 AM

    Hello VMware Community,

    I'm encountering an issue when trying to connect to an HTML console via WebSocket. Below is the process I followed and the error I'm experiencing. Any guidance would be greatly appreciated.

     

    Using Python, I retrieved VNC connection information for a virtual machine. The code snippet used is as follows:

     

    Using Python, I retrieved VNC connection information for a virtual machine. The code snippet used is as follows:

     

     

     

     

     

     

     

     

     

     

    This resulted in the following

    VNC connection information for dev-test - 10.xxxxxxxxxxxx:
    Host: ch1-dev-esxi1.lab.local
    Port: 902
    Ticket: 52xxxxxxxxxxxxxxxxxxxxxxxx
    SSL thumbprint: [Thumbprint]

    Issue:

    However, when attempting to use this information to connect to the HTML console, I'm facing a WebSocket connection failure. The error message is:

    WebSocket connection to 'wss://[IP]:[Port]/ticket/[Ticket-ID]' failed

    Here's the HTML and JavaScript code I used for the connection:

     

     

     

     

     

     

     

     

     

    Additional Checks:

    1. The VM is running without issues.
    2. VMware Tools are installed, current, and running (Version 12288, 12.0.0).

    I'm unsure why this WebSocket connection is failing. Has anyone experienced a similar issue or can provide some insights into what might be going wrong?

    Thank you in advance for your help!



  • 2.  RE: Issue with WebSocket Connection to HTML Console in VMware

    Posted Apr 07, 2024 02:58 PM

    Hi  

    Did you manage to sort this issue, I'm also experiencing this issue



  • 3.  RE: Issue with WebSocket Connection to HTML Console in VMware

    Posted Apr 07, 2024 04:23 PM

     

    Yes. I resolved the issue. 

     

    Can you share the snippet of code you are using? I will try to help.



  • 4.  RE: Issue with WebSocket Connection to HTML Console in VMware

    Posted Apr 09, 2024 06:37 AM

     

    from vcenter, im getting the ticket and the url "wss://02LUM11:443/ticket/c6051953a5b7**********"

    and the html code that was gotten from wmware websorket HTML console

    https://vdc-download.vmware.com/vmwb-repository/dcr-public/42c380d0-4736-41fc-aa3d-76fe5e1bdc81/5fb6f699-5445-41c0-ace9-d351e6caff02/HTML-Cons-220-ReleaseNotes.html


    below is the html code I'm using 


    <title>Console</title>
    <link rel="stylesheet" type="text/css" href="/static/css/wmks-all.css" />
    <script type="text/javascript" src="/static/wmks.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
    </head>
    <body>
    <div id="wmksContainer" style="position:absolute;width:100%;height:100%"></div>
    <script>
    var wmks = WMKS.createWMKS("wmksContainer",{})
    .register(WMKS.CONST.Events.CONNECTION_STATE_CHANGE, function(event,data){
    if(data.state == WMKS.CONST.ConnectionState.CONNECTED){
    console.log("connection state change : connected");}
    });

    wmks.connect("wss://02LUM11:443/ticket/c6051953a5b7**********");
    </script>
    </body>
    </html>



  • 5.  RE: Issue with WebSocket Connection to HTML Console in VMware

    Posted Apr 09, 2024 01:28 PM

    Hi  

    Okay since you are using this url wss://02LUM11:443/ticket/c6051953a5b7**********"

    Please check following 

     

    1. 02LUM11:443 (this should have a valid certificate). If you are using self-signed certificate, go to 02LUM11 in your browser and accept its certificate and then retry connection. This part is important because browsers does not accept self-signed certificate automatically.

    2. In Vcenter there are two functions to acquire ticket AcquireTicket and AcquireWebMKSTicket. Ticket obtained by first method works in our case. . Check this URL

    Sample Javascript Code - HTML Console SDK Programming Guide (vmware.com)

        2a. If you are using python code use 

    vm.AcquireTicket(ticketType='webmks')

     

    Let me know if this helps or if you have any further questions.