Skip to content

SignalR in Electron not working #58545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hillin opened this issue Oct 21, 2024 · 2 comments
Closed

SignalR in Electron not working #58545

hillin opened this issue Oct 21, 2024 · 2 comments
Labels
area-signalr Includes: SignalR clients and servers ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@hillin
Copy link

hillin commented Oct 21, 2024

We have a SignalR hub in our web app, consumed in the frontend with "@microsoft/signalr": "^8.0.0". It worked fine in browsers, but once they are packed into an Electron app (with Electron.NET), an error occurs when trying to connect to the hub:

Error: Failed to start the transport 'WebSockets': Error: ws does not work in the browser. Browser clients must use the native WebSocket object

I can pinpoint the issue down to the following code:

https://github.com/dotnet/aspnetcore/blob/4b8269fca79f95dc28c0c03546f941e86f663c15/src/SignalR/clients/ts/signalr/src/Utils.ts#L56C1-L58C6

Apparently in Electron's renderer process (frontend), the window.process object exists just like in node. In this case SignalR thought it was in a node environment and seek to ws for web socket transportation, which does not work because it's actually a browser environment.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-signalr Includes: SignalR clients and servers label Oct 21, 2024
@BrennanConroy
Copy link
Member

Basically a duplicate of #49065
We'll use the other issue for tracking.

@BrennanConroy BrennanConroy added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Oct 21, 2024
Copy link
Contributor

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

2 participants