You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ability to open web socket connections from background using net #8931
I'm currently building an app that needs websockets in the background process.
There are some packages that do it over Node, but it'd be very convenient if they were handled by electron.net so that proxies are handled the same way it currently does for http(s) connections.
My point is that the netcomponent handles automatically proxies in electron, but only for http(s) connections, and I'd like to have something similar for handling proxies for websockets in the main process.
In the meantime, we've coded a thing similar to what you proposed to handle websocket connections with an intermediate BrowserWindow that communicates through IPC but it's really a hack in my opinion.
It makes sense to provide websocket client support to net module, but it will take a considerable amount of work since the net layer of chromium doesn't expose it directly as a part of URLRequest.
While it is a nice feature to have, implementing web socket on net module would be too much work for our limited resources, so I'm closing this as won't fix. Pull request to add it would be welcomed.
Activity
baconbrad commentedon Mar 20, 2017
I don't quite understand what you are asking.
But if want to have them used in the background then maybe it is as easy as just opening the WS client in the main process. Ref project: https://github.com/116356754/wsobserver
tex0l commentedon Mar 21, 2017
My point is that the
netcomponent handles automatically proxies in electron, but only for http(s) connections, and I'd like to have something similar for handling proxies for websockets in the main process.@arantes555 has built https://github.com/arantes555/electron-fetch to have a polyfill of
fetchin the main process without using an intermediateBrowserWindowwhich is very useful, especially since the chromium implementation of fetch seems to have issues with proxies on Windows (I've reported it on chromium), and we'd like to be able to do the same with websocket connections as well.In the meantime, we've coded a thing similar to what you proposed to handle websocket connections with an intermediate
BrowserWindowthat communicates through IPC but it's really a hack in my opinion.deepak1556 commentedon Mar 21, 2017
It makes sense to provide websocket client support to net module, but it will take a considerable amount of work since the net layer of chromium doesn't expose it directly as a part of
URLRequest.zcbenz commentedon Jun 14, 2017
While it is a nice feature to have, implementing web socket on
netmodule would be too much work for our limited resources, so I'm closing this as won't fix. Pull request to add it would be welcomed.