Don't break the preview on websocket errors

Let us know what you would like to see in the next version of this software

Moderator: kfury77

Forum rules
Please follow these guidelines when posting feature requests. This will help to increase the value of your contribution.
  • Do not create new topics for already requested features. Add your comments to the existing feature request topics instead;
  • Create separate topic for each feature suggestion. Do NOT post a number of non-related feature suggestions in a single topic;
  • Give your topic a meaningful title. Do NOT create topics with meaningless titles, such as "My Suggestion" or "My Problem".
Please note that we DO READ all suggestions, even if a reply is not posted. Thanks!
Post Reply
Acuario
Posts: 7
Joined: Wed Dec 18, 2019 9:14 am

Don't break the preview on websocket errors

Post by Acuario »

My html page has a websocket to connect to my server. Obviously in the preview this is not used but it throws an error dialog box which requires an action.
Can websocket errors be ignored as they are not relevant to the preview.

Code that causes the error:

Code: Select all

var host = location.hostname;
function WebSocketConnect()
{
    if ("WebSocket" in window)
    {
        // Open a web socket
        var ws = new WebSocket("ws://" + host + "/ws");
    }
}
I know I can avoid the error by checking if host is an empty string and not attempting the open if it is empty, but I feel it would be preferable not to see the error.
User avatar
chrisjlocke
Top Contributor
Posts: 995
Joined: Mon Aug 01, 2005 4:12 pm
Location: Essex, UK
Contact:

Re: Don't break the preview on websocket errors

Post by chrisjlocke »

During development, can't you just not use this code? Once you've got the HTML working, then add the socket code?
Post Reply