mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-08 05:37:09 +00:00
33 lines
914 B
C#
33 lines
914 B
C#
namespace ElectronNET.API
|
|
{
|
|
internal static class BridgeConnector
|
|
{
|
|
private static SocketIoFacade _socket;
|
|
private static readonly object SyncRoot = new();
|
|
|
|
public static SocketIoFacade Socket
|
|
{
|
|
get
|
|
{
|
|
if (_socket == null)
|
|
{
|
|
lock (SyncRoot)
|
|
{
|
|
if (_socket == null)
|
|
{
|
|
|
|
string socketUrl = HybridSupport.IsElectronActive
|
|
? $"http://localhost:{BridgeSettings.SocketPort}"
|
|
: "http://localhost";
|
|
|
|
_socket = new SocketIoFacade(socketUrl);
|
|
_socket.Connect();
|
|
}
|
|
}
|
|
}
|
|
|
|
return _socket;
|
|
}
|
|
}
|
|
}
|
|
} |