-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Consider providing override for platform detection in JS/TS SignalR client #49065
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
Comments
After looking at the way that What if we allowed someone to set global variables: signalRPlatformDetectionOverride = "node"; Then |
Today I needed something like this: signalRPlatformDetectionOverride = "browser"; Why? I am using Electron and I need it to have Hence, So, I manually modified the |
I had a same issue as above. I'm trying to use SignalR inside renderer of Electron application. For me it throws with require('eventsource'). Initially i tried to import it from preload script but it only causes chain reaction of require problems. For now i have solved it with hacky monkey patching:
I'm not quite sure what should be proper solution but probably something like:
|
An internal team reached out with a problem they are experiencing with our platform detection logic:
https://github.com/dotnet/aspnetcore/blob/7918436a914ac1cbafa94a359e435c67535c8159/src/SignalR/clients/ts/signalr/src/Utils.ts#L40C9-L40C9
Locally this works, but they are seeing a problem in production where it is detecting that it is in the browser instead of Node. This could possibly be due to global namespace pollution from another package that is impacting their code that runs locally.
They asked whether it would be possible to provide the ability to override the platform detection logic.
Another possibility is that we could see whether there is a better way to detect that we are running in Node vs. looking for the presence of the window global variable.
The text was updated successfully, but these errors were encountered: