Coder Social home page Coder Social logo

Comments (10)

doghappy avatar doghappy commented on July 19, 2024

Good idea, there is only one problem that needs to be solved: how to use WebSocket client on .Net Fx 4+?

The current project uses System.Net.Websockets.Client.dll as the ws client, which supports .NET Standard 1.3+ (.NET Fx 4.6+). Therefore, we only need to find alternatives and implement the IWebSocketClient interface.

It's worth noting that if we don't install System.Net.Websocket.Client from NuGet, we can also import the namespace, but it belongs to System.dll, running on Windows 7, will throw a PlatformNotSupportedException

Some of the classes and class elements in the System.Net.WebSockets namespace are supported on Windows 7, Windows Vista SP2, and Windows Server 2008. However, the only public implementations of client and server WebSockets are supported on Windows 8 and Windows Server 2012. The class elements in the System.Net.WebSockets namespace that are supported on Windows 7, Windows Vista SP2, and Windows Server 2008 are abstract class elements. This allows an application developer to inherit and extend these abstract class classes and class elements with an actual implementation of client WebSockets.

from socket.io-client-csharp.

doghappy avatar doghappy commented on July 19, 2024

I tried it and it seems difficult to support .NET Fx 4.5.2 and below, The following implementation is missing:

  • Task.CompletedTask
  • Task.Delay()

Different delegate signatures:

.NET Framework 4.0:

public delegate void EventHandler<TEventArgs>(object sender, TEventArgs e) where TEventArgs : EventArgs;

.NET Standard 2.0:

public delegate void EventHandler<TEventArgs>(object sender, TEventArgs e);

This may have to change the code of the SocketIO.cs

from socket.io-client-csharp.

mathrb avatar mathrb commented on July 19, 2024

I agree that it does not work with .NET Framework 4.0, but it works like a charm on .NET Framework 4.5 (Currently I've tested win 10 only)

from socket.io-client-csharp.

mathrb avatar mathrb commented on July 19, 2024

NuGet does not provide a way to target a specific OS version.
I think providing a .Net Fx 4.5+ can still benefit people. Even websocket-sharp does not support windows 7 (sta/websocket-sharp#572). This would require a proper documentation.

from socket.io-client-csharp.

doghappy avatar doghappy commented on July 19, 2024

https://github.com/doghappy/socket.io-client-csharp/tree/feat-netfx4.5

In this branch, I added some code that may be useful to you

from socket.io-client-csharp.

mathrb avatar mathrb commented on July 19, 2024

Works fine on my side. Though it would require a -pre release since websocketsharp version is 1.0.3-rc11

from socket.io-client-csharp.

mathrb avatar mathrb commented on July 19, 2024

How could I help accelerate the publication to NuGet?

from socket.io-client-csharp.

doghappy avatar doghappy commented on July 19, 2024

Install-Package SocketIOClient.NetFx -Version 1.0.0-alpha3

from socket.io-client-csharp.

mathrb avatar mathrb commented on July 19, 2024

Hello,

Made a few test with the NetFx version. I'm concerned about reconnexion with Websocketsharp. I doesn't work as expected. Using the ClientWebSocket of the framework, it works correctly.

from socket.io-client-csharp.

doghappy avatar doghappy commented on July 19, 2024

If your TargetFramework is .NET Framework and it runs on Windows7/Windows Server 2008 R2, please install NuGet

Otherwise, we recommend you to install NuGet

from socket.io-client-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.