I deployed my backend server on google cloud engine and it generated an https. I am unable to use this with Websocket javascript library at frontend (react) and generates the following error:
SyntaxError: Failed to construct 'WebSocket': The URL's scheme must be either 'ws' or 'wss'. 'https' is not allowed.
Please tell me if there is a workaround.
- https link generated from google cloud engine where my golang backend server is: 'https://project-name'
- websocket currently being initialized by:
var socket = new WebSocket('ws://localhost:9000/ws');