Closed 0Akise closed 6 months ago
seems like HQ
is just a automatically generated symbol for Javascript...
HQ=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")};
what is native WebSocket???
two things I found:
1. ws does not work in the browser. Browser clients must use the native WebSocket object
2. Electron does not have WebSocket, WebSocket is a Web API.
but that being said, I should be able to use ws
package in main. why am I having this error?
why am I having this error?
Probably because you are bundling for the browser.
so as I understand, in the template I used, I think vite is bundling main file as browser for some reason.
I believe this is not from ws
package, thus closing ticket.
It is from ws
, see https://github.com/websockets/ws/blob/d343a0cf7bba29a4e14217cb010446bec8fdf444/browser.js#L1-L8 but it happens when ws
is bundled for the browser, see https://github.com/websockets/ws/blob/d343a0cf7bba29a4e14217cb010446bec8fdf444/package.json#L24
Is there an existing issue for this?
Description
I'm not sure if this error is from
ws
package, if not, I'm sorry.I have setup my project via [https://github.com/tgrassl/solid-vite-electron/]
and I have following codes:
and every time, the function
startEngine()
is invoked, following error occurs:is this because I'm using websocket inside IPC? I'm not sure what is going on. I double checked that WebSocket url is correct. and surprisingly I cannot find any search result on the internet about "Error Creating WebSocket".
= new WebSocket('')
part to just at the middle of main, and got this error:ws version
8.16.0
Node.js Version
v18.17.1
System
System: OS: Windows 10 10.0.19045 CPU: (32) x64 AMD Ryzen 9 3950X 16-Core Processor Memory: 43.75 GB / 63.91 GB
Expected result
error should not appear and websocket creates.
Actual result
following error:
Attachments
No response