| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Net; |
| | | 6 | | using System.Net.WebSockets; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Channels |
| | | 9 | | { |
| | | 10 | | internal static class TransportDefaults |
| | | 11 | | { |
| | | 12 | | internal const long MaxReceivedMessageSize = 65536; |
| | | 13 | | internal const int MaxBufferSize = (int)MaxReceivedMessageSize; |
| | | 14 | | internal const bool RequireClientCertificate = false; |
| | | 15 | | } |
| | | 16 | | |
| | | 17 | | public static class BasicHttpBindingDefaults |
| | | 18 | | { |
| | | 19 | | public const WSMessageEncoding MessageEncoding = WSMessageEncoding.Text; |
| | | 20 | | } |
| | | 21 | | |
| | | 22 | | internal static class HttpTransportDefaults |
| | | 23 | | { |
| | | 24 | | internal const AuthenticationSchemes AuthenticationScheme = AuthenticationSchemes.Anonymous; |
| | | 25 | | internal const TransferMode TransferMode = CoreWCF.TransferMode.Buffered; |
| | | 26 | | internal const bool KeepAliveEnabled = true; |
| | | 27 | | internal const string Realm = ""; |
| | | 28 | | |
| | | 29 | | internal static WebSocketTransportSettings GetDefaultWebSocketTransportSettings() |
| | | 30 | | { |
| | | 31 | | return new WebSocketTransportSettings(); |
| | | 32 | | } |
| | | 33 | | } |
| | | 34 | | |
| | | 35 | | internal static class ConnectionOrientedTransportDefaults |
| | | 36 | | { |
| | | 37 | | internal const int ConnectionBufferSize = 8192; |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | internal static class WebSocketDefaults |
| | | 41 | | { |
| | | 42 | | internal const WebSocketTransportUsage TransportUsage = WebSocketTransportUsage.Never; |
| | | 43 | | internal const bool CreateNotificationOnConnection = false; |
| | 5 | 44 | | internal static readonly TimeSpan DefaultKeepAliveInterval = TimeSpan.FromSeconds(0); |
| | | 45 | | |
| | | 46 | | internal const int BufferSize = 16 * 1024; |
| | | 47 | | internal const int MinReceiveBufferSize = 256; |
| | | 48 | | internal const int MinSendBufferSize = 16; |
| | | 49 | | internal const bool DisablePayloadMasking = false; |
| | | 50 | | internal const WebSocketMessageType DefaultWebSocketMessageType = WebSocketMessageType.Binary; |
| | | 51 | | internal const string SubProtocol = null; |
| | | 52 | | |
| | | 53 | | internal const int DefaultMaxPendingConnections = 0; |
| | | 54 | | // We set this number larger than that in TCP transport because in WebSocket cases, the connection is already au |
| | | 55 | | // after we create the half-open channel. The default value is set as the default one as MaxConcurrentSessions t |
| | | 56 | | // well in burst scenarios. |
| | | 57 | | internal const int DefaultMaxConcurrentSessions = 100; |
| | 5 | 58 | | internal static readonly int MaxPendingConnectionsCpuCount = DefaultMaxConcurrentSessions * Environment.Processo |
| | | 59 | | |
| | | 60 | | internal const string WebSocketConnectionHeaderValue = "Upgrade"; |
| | | 61 | | internal const string WebSocketUpgradeHeaderValue = "websocket"; |
| | | 62 | | } |
| | | 63 | | |
| | | 64 | | internal static class NetHttpBindingDefaults |
| | | 65 | | { |
| | | 66 | | internal const NetHttpMessageEncoding MessageEncoding = NetHttpMessageEncoding.Binary; |
| | | 67 | | internal const WebSocketTransportUsage TransportUsage = WebSocketTransportUsage.WhenDuplex; |
| | | 68 | | } |
| | | 69 | | } |