Switch to another socket.io for c# lib #464

Closed
opened 2026-01-29 16:40:14 +00:00 by claunia · 33 comments
Owner

Originally created by @yukozh on GitHub (Mar 15, 2020).

Originally assigned to: @GregorBiswanger on GitHub.

The SocketIoClientDotNet team will no longer maintain their project, and they've hidden their package, that blocks the nuget restore.

Originally created by @yukozh on GitHub (Mar 15, 2020). Originally assigned to: @GregorBiswanger on GitHub. The SocketIoClientDotNet team will no longer maintain their project, and they've hidden their package, that blocks the nuget restore.
claunia added the help wanted label 2026-01-29 16:40:14 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Mar 15, 2020):

Yes, that's right and it's a problem. Unfortunately we have not yet found an alternative.

However Electron.NET currently works without problems with the last version of SocketIoClientDotNet.

Or did you have difficulties?

@GregorBiswanger commented on GitHub (Mar 15, 2020): Yes, that's right and it's a problem. Unfortunately we have not yet found an alternative. However Electron.NET currently works without problems with the last version of SocketIoClientDotNet. Or did you have difficulties?
Author
Owner

@query-wow commented on GitHub (Mar 18, 2020):

Good afternoon, i've been reading into this project, looks promising. Might be worth to check perhaps? https://github.com/LadislavBohm/socket.io-client-core

@query-wow commented on GitHub (Mar 18, 2020): Good afternoon, i've been reading into this project, looks promising. Might be worth to check perhaps? https://github.com/LadislavBohm/socket.io-client-core
Author
Owner

@GregorBiswanger commented on GitHub (Apr 17, 2020):

We would definitely have to try it out with a prototype.

It currently works with the last SocketIoClientDotNet version.

@GregorBiswanger commented on GitHub (Apr 17, 2020): We would definitely have to try it out with a prototype. It currently works with the last SocketIoClientDotNet version.
Author
Owner

@GregorBiswanger commented on GitHub (May 10, 2020):

FYI @syedadeel2

@GregorBiswanger commented on GitHub (May 10, 2020): FYI @syedadeel2
Author
Owner

@syedadeel2 commented on GitHub (May 11, 2020):

FYI @syedadeel2

No more Sockets I'm near to the solution.

@syedadeel2 commented on GitHub (May 11, 2020): > FYI @syedadeel2 No more Sockets I'm near to the solution.
Author
Owner

@dafergu2 commented on GitHub (May 18, 2020):

FYI @syedadeel2

No more Sockets I'm near to the solution.

I'd be interested in helping with this. I've seen the bridge connector flake out on me after leaving my app running for a long time and it is the one thing that worries me the most.

What are you looking to swap this out with, @syedadeel2 ?

@dafergu2 commented on GitHub (May 18, 2020): > > FYI @syedadeel2 > > No more Sockets I'm near to the solution. I'd be interested in helping with this. I've seen the bridge connector flake out on me after leaving my app running for a long time and it is the one thing that worries me the most. What are you looking to swap this out with, @syedadeel2 ?
Author
Owner

@dafergu2 commented on GitHub (May 18, 2020):

Good afternoon, i've been reading into this project, looks promising. Might be worth to check perhaps? https://github.com/LadislavBohm/socket.io-client-core

This is also an option to explore: https://github.com/HavenDV/H.Socket.IO/

@dafergu2 commented on GitHub (May 18, 2020): > Good afternoon, i've been reading into this project, looks promising. Might be worth to check perhaps? https://github.com/LadislavBohm/socket.io-client-core This is also an option to explore: https://github.com/HavenDV/H.Socket.IO/
Author
Owner

@syedadeel2 commented on GitHub (May 20, 2020):

FYI @syedadeel2

No more Sockets I'm near to the solution.

I'd be interested in helping with this. I've seen the bridge connector flake out on me after leaving my app running for a long time and it is the one thing that worries me the most.

What are you looking to swap this out with, @syedadeel2 ?

I'll reveal soon once I finish the solution. But no sockets for sure.

@syedadeel2 commented on GitHub (May 20, 2020): > > > FYI @syedadeel2 > > > > > > No more Sockets I'm near to the solution. > > I'd be interested in helping with this. I've seen the bridge connector flake out on me after leaving my app running for a long time and it is the one thing that worries me the most. > > What are you looking to swap this out with, @syedadeel2 ? I'll reveal soon once I finish the solution. But no sockets for sure.
Author
Owner

@sanosdole commented on GitHub (May 25, 2020):

There is an existing solution for C#/JS interop without websockets: https://github.com/sanosdole/nodeclrhost

If there is any interest in using it, i could provide assistance.

@sanosdole commented on GitHub (May 25, 2020): There is an existing solution for C#/JS interop without websockets: <https://github.com/sanosdole/nodeclrhost> If there is any interest in using it, i could provide assistance.
Author
Owner

@GregorBiswanger commented on GitHub (May 25, 2020):

@syedadeel2 can you check this please?

@GregorBiswanger commented on GitHub (May 25, 2020): @syedadeel2 can you check this please?
Author
Owner

@sanosdole commented on GitHub (May 25, 2020):

Easiest way to review the capabilities:

  1. Check out the repository
  2. Go into ~/examples/electron-blazor and run npm run
  3. Read/Debug the dotnet source code for the browser (~/examples/electron-blazor/LocalService) & renderer process (~/examples/electron-blazor/BlazorApp)

Here is an old image from the example code that shows the first debugging of a Blazor App in Electron:
Blazor App Debugging

@sanosdole commented on GitHub (May 25, 2020): Easiest way to review the capabilities: 1. Check out the repository 2. Go into `~/examples/electron-blazor` and run `npm run` 3. Read/Debug the dotnet source code for the browser (`~/examples/electron-blazor/LocalService`) & renderer process (`~/examples/electron-blazor/BlazorApp`) Here is an old image from the example code that shows the first debugging of a Blazor App in Electron: ![Blazor App Debugging](https://github.com/sanosdole/nodeclrhost/blob/master/examples/electron-blazor/BlazorApp/wwwroot/exampleImage.gif?raw=true)
Author
Owner

@GregorBiswanger commented on GitHub (May 25, 2020):

@sanosdole Thanks! electron-blazor uses Electron.NET :)

But we will definitely look at this...
Possibly, can you even build a small prototype?!
Here is a YouTube video that explains something about Electron.NET under the hood:
https://www.youtube.com/watch?v=Po-saU_Z6Ws

@GregorBiswanger commented on GitHub (May 25, 2020): @sanosdole Thanks! electron-blazor uses Electron.NET :) But we will definitely look at this... Possibly, can you even build a small prototype?! Here is a YouTube video that explains something about Electron.NET under the hood: https://www.youtube.com/watch?v=Po-saU_Z6Ws
Author
Owner

@sanosdole commented on GitHub (May 25, 2020):

@GregorBiswanger Thanks! electron-blazor uses Electron.NET :)

The prototype steve sanderson did. This one is an example from the nodeclrhost repository. It does not use Electron.NET and also no WASM. It invokes the Electron APIs directly in process using the C#/JS Interop.

Does this qualify as a small prototype? If not I have a large prototype but that is owned by my clients and i may not share this in the public.

I know the inner working of Electron.NET quite well, as we (me and a client of mine) researched it for replacing the GUI layer of a large XAML based application. So i read most of the code of this projects around a year ago.
As we required direct renderer memory access for some special 3D controls, I started this project to host a dotnet core CLR through a native node addon.

Edit: I`ll watch the video later this evening when I have time. At first I thought you meant the introductionary Video on how to use electron.

@sanosdole commented on GitHub (May 25, 2020): @GregorBiswanger Thanks! electron-blazor uses Electron.NET :) The prototype steve sanderson did. [This one is an example from the nodeclrhost repository](https://github.com/sanosdole/nodeclrhost/tree/master/examples/electron-blazor). It does not use Electron.NET and also no WASM. It invokes the Electron APIs directly in process using the C#/JS Interop. Does this qualify as a small prototype? If not I have a large prototype but that is owned by my clients and i may not share this in the public. I know the inner working of Electron.NET quite well, as we (me and a client of mine) researched it for replacing the GUI layer of a large XAML based application. So i read most of the code of this projects around a year ago. As we required direct renderer memory access for some special 3D controls, I started this project to host a dotnet core CLR through a native node addon. Edit: I`ll watch the video later this evening when I have time. At first I thought you meant the introductionary Video on how to use electron.
Author
Owner

@GregorBiswanger commented on GitHub (May 25, 2020):

@sanosdole everything sounds very exciting.. I will take a closer look at this tonight and how we could take it with us..

how does the communication of classic ASP.NET Core MVC / Razor Pages work out here? They always need a web host to get their HTML pages?!

@GregorBiswanger commented on GitHub (May 25, 2020): @sanosdole everything sounds very exciting.. I will take a closer look at this tonight and how we could take it with us.. how does the communication of classic ASP.NET Core MVC / Razor Pages work out here? They always need a web host to get their HTML pages?!
Author
Owner

@sanosdole commented on GitHub (May 25, 2020):

how does the communication of classic ASP.NET Core MVC / Razor Pages work out here? They always need a web host to get their HTML pages?!

I researched this when i started. It is theoretically possible to skip opening a port using an electron resource handler implementation. But to get this working an alternative WebHost implementation is required and that would require some heavy (reverse-)engineering work. Especially making websockets (e.g. Server-Side Blazor) work would be quite an investment.

I never did an example for a MVC app, but i think it would be straight forward when using kestrel.

@sanosdole commented on GitHub (May 25, 2020): > how does the communication of classic ASP.NET Core MVC / Razor Pages work out here? They always need a web host to get their HTML pages?! I researched this when i started. It is theoretically possible to skip opening a port using an electron resource handler implementation. But to get this working an alternative WebHost implementation is required and that would require some heavy (reverse-)engineering work. Especially making websockets (e.g. Server-Side Blazor) work would be quite an investment. I never did an example for a MVC app, but i think it would be straight forward when using kestrel.
Author
Owner

@syedadeel2 commented on GitHub (May 29, 2020):

@syedadeel2 can you check this please?

This is was my original plan using JSInterop but I'm looking in different solution as I find the performance is not as what I'm expecting when doing a lot of calls. Other thing is that this good when you are app is running the in electron but what we are trying here to controls the electron on startup and hook events at this stage your app isn't loaded in the browser. to resolve this I'm actually testing some different solution and use cases. But good work has been done for "nodeclrhost" and have lot of potentials. Maybe I will combine this in my solution

And I'm trying not to build this especially for Blazor - my scope is to build one for all of-course the SPA/PWA gives the best experiences.

I'll let you know once I'm near to this :)

@syedadeel2 commented on GitHub (May 29, 2020): > @syedadeel2 can you check this please? This is was my original plan using JSInterop but I'm looking in different solution as I find the performance is not as what I'm expecting when doing a lot of calls. Other thing is that this good when you are app is running the in electron but what we are trying here to controls the electron on startup and hook events at this stage your app isn't loaded in the browser. to resolve this I'm actually testing some different solution and use cases. But good work has been done for "nodeclrhost" and have lot of potentials. Maybe I will combine this in my solution And I'm trying not to build this especially for Blazor - my scope is to build one for all of-course the SPA/PWA gives the best experiences. I'll let you know once I'm near to this :)
Author
Owner

@sanosdole commented on GitHub (May 29, 2020):

your app isn't loaded in the browser

Well this is not true. The dotnet CLR is hosted by the node process using a native plugin. Everything is in one process and calls are native. We are directly hooking up dotnet code and JS code.

as I find the performance is not as what I'm expecting when doing a lot of calls

The benchmarks in the coreclr-hosting package shows that invoking JS is of course slower than JS itself. (Mostly due to optimizations in the v8)
We are talking about 15000000 ops/sec on my machine. That is about 0.66 micro-seconds overhead per JS invocation.
The only possible architectural optimization I´m seeing is skipping the nodeJS native ABI and directly integrating with the used v8 engine. And this would be tremendous work for not much of an improvement.
Am I missing an alternative way to integrate dotnet with JS?

And I'm trying not to build this especially for Blazor

nodeclrhost is a generic node/dotnet interop mechanism first (coreclr-hosting & NodeHostEnvironment projects). It is not bound to Electron or ASP.NET. The Blazor in renderer Process parts are separate projects (electron-blazor-glue & ElectronHostedBlazor projects) that could be moved to another repository.

Also please take a look at the mvc-example branch. It contains a fully working MVC/RazorPages Electron application in ~/examples/electron-mvc. The only thing modified from the default webapp template is the Program.cs.

@sanosdole commented on GitHub (May 29, 2020): > your app isn't loaded in the browser Well this is not true. The dotnet CLR is hosted by the node process using a native plugin. Everything is in one process and calls are native. We are directly hooking up dotnet code and JS code. > as I find the performance is not as what I'm expecting when doing a lot of calls The benchmarks in the `coreclr-hosting` package shows that invoking JS is of course slower than JS itself. (Mostly due to optimizations in the v8) We are talking about 15000000 ops/sec on my machine. That is about 0.66 micro-seconds overhead per JS invocation. The only possible architectural optimization I´m seeing is skipping the nodeJS native ABI and directly integrating with the used v8 engine. And this would be tremendous work for not much of an improvement. Am I missing an alternative way to integrate dotnet with JS? > And I'm trying not to build this especially for Blazor `nodeclrhost` is a generic node/dotnet interop mechanism first (`coreclr-hosting` & `NodeHostEnvironment` projects). It is not bound to Electron or ASP.NET. The _Blazor in renderer Process_ parts are separate projects (`electron-blazor-glue` & `ElectronHostedBlazor` projects) that could be moved to another repository. Also please take a look at the [mvc-example](https://github.com/sanosdole/nodeclrhost/tree/mvc-example) branch. It contains a fully working MVC/RazorPages Electron application in `~/examples/electron-mvc`. The only thing modified from the default `webapp` template is the `Program.cs`.
Author
Owner

@freosc commented on GitHub (Jul 1, 2020):

@syedadeel2 Did you reach any progress on this one? I'm anxious to know cause I need to decide whether to use ElectronJs with or without Electron.net.

@freosc commented on GitHub (Jul 1, 2020): @syedadeel2 Did you reach any progress on this one? I'm anxious to know cause I need to decide whether to use ElectronJs with or without Electron.net.
Author
Owner

@GregorBiswanger commented on GitHub (Jul 1, 2020):

@freosc You can use Electron.NET without problems. We would change the communication, but without breaking changes here.

@GregorBiswanger commented on GitHub (Jul 1, 2020): @freosc You can use Electron.NET without problems. We would change the communication, but without breaking changes here.
Author
Owner

@freosc commented on GitHub (Jul 1, 2020):

@freosc You can use Electron.NET without problems. We would change the communication, but without breaking changes here.

Many thanks for the work you've done to this project already. But can you give me an expected ETA of the new IPC backend? I'll be one of the pioneers to test it ;)

@freosc commented on GitHub (Jul 1, 2020): > @freosc You can use Electron.NET without problems. We would change the communication, but without breaking changes here. Many thanks for the work you've done to this project already. But can you give me an expected ETA of the new IPC backend? I'll be one of the pioneers to test it ;)
Author
Owner

@GregorBiswanger commented on GitHub (Jul 1, 2020):

@freosc Do you have currently problems with the current one?

I have no time plan, I think the next weeks we have more Infos for you.

@GregorBiswanger commented on GitHub (Jul 1, 2020): @freosc Do you have currently problems with the current one? I have no time plan, I think the next weeks we have more Infos for you.
Author
Owner

@freosc commented on GitHub (Jul 1, 2020):

The problem I have is the disconnecting issue (Got disconnect! Reason ping timeout). Even with 9.31.1 and the latest SocketIO client.
If I leave the app running for a few hours on a test PC without doing anything (actually 2 hours seems to be enough), a disconnect occurs (ping timeout), after that, all communication is broken between browser and .net core mvc app.

@freosc commented on GitHub (Jul 1, 2020): The problem I have is the disconnecting issue (Got disconnect! Reason ping timeout). Even with 9.31.1 and the latest SocketIO client. If I leave the app running for a few hours on a test PC without doing anything (actually 2 hours seems to be enough), a disconnect occurs (ping timeout), after that, all communication is broken between browser and .net core mvc app.
Author
Owner

@syedadeel2 commented on GitHub (Jul 4, 2020):

@syedadeel2 Did you reach any progress on this one? I'm anxious to know cause I need to decide whether to use ElectronJs with or without Electron.net.

I'll update you guys soon, Sorry just got caught with COVID-19 stuff within my organization and I'm hardly getting time for me. But let me give you guys some insight I'm working with Edge.js to use In-process method to avoid the Sockets. I'll soon complete the small prototype and share with @GregorBiswanger. Once we agreed we will start working on the full project not sure maybe a separate repo.

@syedadeel2 commented on GitHub (Jul 4, 2020): > @syedadeel2 Did you reach any progress on this one? I'm anxious to know cause I need to decide whether to use ElectronJs with or without Electron.net. I'll update you guys soon, Sorry just got caught with COVID-19 stuff within my organization and I'm hardly getting time for me. But let me give you guys some insight I'm working with Edge.js to use In-process method to avoid the Sockets. I'll soon complete the small prototype and share with @GregorBiswanger. Once we agreed we will start working on the full project not sure maybe a separate repo.
Author
Owner

@sanosdole commented on GitHub (Jul 4, 2020):

@syedadeel2 If you are using EdgeJS please consider switching over to nodeclrhost.

We have written nodeclrhost because edge.js is a dead project. It has not been updated for some years now (last commit on official repo is more than 3 years ago) and has no official support for the core clr. There are some forks that might work, but nodeclrhost has a lot more features like a less restrictive interop API based on the dynamic language runtime with support for synchronous JS invocation and invoking any JS code directly from C#.

I also have already done a prototype that is running Electron.NET through nodeclrhost over here. It basically works besides having Exceptions on shutdown and not being tested thoroughly.

I only spend a few hours to write the Electron.NET prototype, so it proves viability. The downsides of in-process communication are the same as for edge.js, it only uses a different interop API. I believe it would be advantageous to merge efforts here, as it is the same thing without a dead project in the middle.

If you are interested in using nodeclrhost instead of edgejs, i could give you some help. I want people to work with nodeclrhost so I can improve its API, documentation and stability.

@sanosdole commented on GitHub (Jul 4, 2020): @syedadeel2 If you are using [EdgeJS](https://tjanczuk.github.io/edge/#/) please consider switching over to [nodeclrhost](https://github.com/sanosdole/nodeclrhost). We have written `nodeclrhost` because `edge.js` is a dead project. It has not been updated for some years now (last commit on [official repo](https://github.com/tjanczuk/edge) is more than 3 years ago) and has no official support for the core clr. There are some forks that might work, but `nodeclrhost` has a lot more features like a less restrictive interop API based on the _dynamic language runtime_ with support for synchronous JS invocation and invoking any JS code directly from C#. I also have already done a prototype that is running `Electron.NET` through `nodeclrhost` over [here](https://github.com/sanosdole/Electron.NET/tree/replace-sockets-nodeclrhost). It basically works besides having Exceptions on shutdown and not being tested thoroughly. I only spend a few hours to write the `Electron.NET` prototype, so it proves viability. The downsides of in-process communication are the same as for `edge.js`, it only uses a different interop API. I believe it would be advantageous to merge efforts here, as it is the same thing without a dead project in the middle. If you are interested in using `nodeclrhost` instead of `edgejs`, i could give you some help. I want people to work with `nodeclrhost` so I can improve its API, documentation and stability.
Author
Owner

@syedadeel2 commented on GitHub (Jul 5, 2020):

@sanosdole I can see what you are saying :) I have forked your nodeclrhost let me try that as well.

@syedadeel2 commented on GitHub (Jul 5, 2020): @sanosdole I can see what you are saying :) I have forked your nodeclrhost let me try that as well.
Author
Owner

@syedadeel2 commented on GitHub (Jul 10, 2020):

@sanosdole @GregorBiswanger I have sent you guys an invite to join my private repo where I'm pushing the code for the new version. It's not ready yet just a skeleton but just added you guys so we can create the project and think about what to add and what not.

@syedadeel2 commented on GitHub (Jul 10, 2020): @sanosdole @GregorBiswanger I have sent you guys an invite to join my private repo where I'm pushing the code for the new version. It's not ready yet just a skeleton but just added you guys so we can create the project and think about what to add and what not.
Author
Owner

@rakista112 commented on GitHub (Jul 30, 2020):

@syedadeel2 I could help with mac efforts in the new IPC backend if you invite me to the repo.
Our project is invested in Electron.NET and we are facing the disconnect/no-reconnect issue in Mac.

@rakista112 commented on GitHub (Jul 30, 2020): @syedadeel2 I could help with mac efforts in the new IPC backend if you invite me to the repo. Our project is invested in Electron.NET and we are facing the disconnect/no-reconnect issue in Mac.
Author
Owner

@freosc commented on GitHub (Aug 12, 2020):

@syedadeel2 Did you reach any progress? What's the plan? If extra help is needed, I'm also willing to do something.

@freosc commented on GitHub (Aug 12, 2020): @syedadeel2 Did you reach any progress? What's the plan? If extra help is needed, I'm also willing to do something.
Author
Owner

@GregorBiswanger commented on GitHub (Aug 12, 2020):

@freosc The last few weeks I've been busy with my business. I think I will have time for that in the next few weeks.

@GregorBiswanger commented on GitHub (Aug 12, 2020): @freosc The last few weeks I've been busy with my business. I think I will have time for that in the next few weeks.
Author
Owner

@syedadeel2 commented on GitHub (Aug 13, 2020):

@freosc The last few weeks I've been busy with my business. I think I will have time for that in the next few weeks.

that's why I was wondering where you gone :)

@syedadeel2 commented on GitHub (Aug 13, 2020): > @freosc The last few weeks I've been busy with my business. I think I will have time for that in the next few weeks. that's why I was wondering where you gone :)
Author
Owner

@syedadeel2 commented on GitHub (Sep 19, 2020):

@sanosdole I'm working on the new repo, and I'm still waiting for you to accept my invite also there is some issue with your nodeclr if you have time we can talk about.

@syedadeel2 commented on GitHub (Sep 19, 2020): @sanosdole I'm working on the new repo, and I'm still waiting for you to accept my invite also there is some issue with your nodeclr if you have time we can talk about.
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Author
Owner

@Yuvix25 commented on GitHub (Jan 31, 2024):

Any update on this? Help needed?

@Yuvix25 commented on GitHub (Jan 31, 2024): Any update on this? Help needed?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#464