Skip to content

Ability to open web socket connections from background using net #8931

Closed

Description

@tex0l

Hi!

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.

Is that possible ?

Activity

  1. baconbrad commented on Mar 20, 2017

    @baconbrad
    Contributor

    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

  2. tex0l commented on Mar 21, 2017

    @tex0l
    Author

    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 fetch in the main process without using an intermediate BrowserWindow which 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 BrowserWindow that communicates through IPC but it's really a hack in my opinion.

  3. deepak1556 commented on Mar 21, 2017

    @deepak1556
    Member

    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.

  4. zcbenz commented on Jun 14, 2017

    @zcbenz
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions