예제 #1
0
 private Task ProcessNegotiationRequest(HostContext context)
 {
     context.Response.ContentType = Json.MimeType;
     return(context.Response.EndAsync(_jsonSerializer.Stringify(new
     {
         Url = context.Request.Url.LocalPath.Replace("/negotiate", ""),
         ConnectionId = _connectionIdFactory.CreateConnectionId(context.Request),
         TryWebSockets = context.SupportsWebSockets(),
         WebSocketServerUrl = context.WebSocketServerUrl(),
         ProtocolVersion = "1.0"
     })));
 }
예제 #2
0
        private Task ProcessNegotiationRequest(HostContext context)
        {
            var payload = new
            {
                Url                = context.Request.Url.LocalPath.Replace("/negotiate", ""),
                ConnectionId       = _connectionIdPrefixGenerator.GenerateConnectionIdPrefix(context.Request) + Guid.NewGuid().ToString("d"),
                TryWebSockets      = _transportManager.SupportsTransport(WebSocketsTransportName) && context.SupportsWebSockets(),
                WebSocketServerUrl = context.WebSocketServerUrl(),
                ProtocolVersion    = "1.0"
            };

            if (!String.IsNullOrEmpty(context.Request.QueryString["callback"]))
            {
                return(ProcessJsonpNegotiationRequest(context, payload));
            }

            context.Response.ContentType = Json.MimeType;
            return(context.Response.EndAsync(_jsonSerializer.Stringify(payload)));
        }
예제 #3
0
        private Task ProcessNegotiationRequest(HostContext context)
        {
            var payload = new
            {
                Url = context.Request.Url.LocalPath.Replace("/negotiate", ""),
                ConnectionId = _connectionIdGenerator.GenerateConnectionId(context.Request),
                TryWebSockets = _transportManager.SupportsTransport(WebSocketsTransportName) && context.SupportsWebSockets(),
                WebSocketServerUrl = context.WebSocketServerUrl(),
                ProtocolVersion = "1.0"
            };

            if (!String.IsNullOrEmpty(context.Request.QueryString["callback"]))
            {
                return ProcessJsonpNegotiationRequest(context, payload);
            }

            context.Response.ContentType = Json.MimeType;
            return context.Response.EndAsync(_jsonSerializer.Stringify(payload));
        }
예제 #4
0
 private Task ProcessNegotiationRequest(HostContext context)
 {
     context.Response.ContentType = Json.MimeType;
     return context.Response.EndAsync(_jsonSerializer.Stringify(new
     {
         Url = context.Request.Url.LocalPath.Replace("/negotiate", ""),
         ConnectionId = _connectionIdFactory.CreateConnectionId(context.Request),
         TryWebSockets = context.SupportsWebSockets(),
         WebSocketServerUrl = context.WebSocketServerUrl(),
         ProtocolVersion = "1.0"
     }));
 }
        private Task ProcessNegotiationRequest(HostContext context)
        {
            var keepAlive = _configurationManager.KeepAlive;
            var payload = new
            {
                Url = context.Request.Url.LocalPath.Replace("/negotiate", ""),
                ConnectionId = _connectionIdPrefixGenerator.GenerateConnectionIdPrefix(context.Request) + Guid.NewGuid().ToString("d"),
                KeepAlive = (keepAlive != null) ? keepAlive.Value.TotalSeconds : (double?)null,
                TryWebSockets = _transportManager.SupportsTransport(WebSocketsTransportName) && context.SupportsWebSockets(),
                WebSocketServerUrl = context.WebSocketServerUrl(),
                ProtocolVersion = "1.0"
            };

            if (!String.IsNullOrEmpty(context.Request.QueryString["callback"]))
            {
                return ProcessJsonpNegotiationRequest(context, payload);
            }

            context.Response.ContentType = Json.MimeType;
            return context.Response.EndAsync(_jsonSerializer.Stringify(payload));
        }