aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-07 10:52:38 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-07 10:52:38 -0500
commitf32212d160f5427a56b5b8e0219206930c518b64 (patch)
treeeddda40fe8c4d46cd0a0009939607681da89f03c /MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
parent1b1bcabbb12a3ab2c9b8c5b319423eb3860c9987 (diff)
update to service stack v4
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
index a40dff5a4..ff822a4e6 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
@@ -184,5 +184,41 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// </summary>
/// <value>The on receive.</value>
public Action<string> OnReceive { get; set; }
+
+ /// <summary>
+ /// The _supports native web socket
+ /// </summary>
+ private static bool? _supportsNativeWebSocket;
+
+ /// <summary>
+ /// Gets a value indicating whether [supports web sockets].
+ /// </summary>
+ /// <value><c>true</c> if [supports web sockets]; otherwise, <c>false</c>.</value>
+ public static bool IsSupported
+ {
+ get
+ {
+#if __MonoCS__
+ return false;
+#else
+#endif
+
+ if (!_supportsNativeWebSocket.HasValue)
+ {
+ try
+ {
+ new ClientWebSocket();
+
+ _supportsNativeWebSocket = true;
+ }
+ catch (PlatformNotSupportedException)
+ {
+ _supportsNativeWebSocket = false;
+ }
+ }
+
+ return _supportsNativeWebSocket.Value;
+ }
+ }
}
}