本文整理汇总了C#中PersistentResponse类的典型用法代码示例。如果您正苦于以下问题:C# PersistentResponse类的具体用法?C# PersistentResponse怎么用?C# PersistentResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistentResponse类属于命名空间,在下文中一共展示了PersistentResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Send
public override Task Send(PersistentResponse response)
{
var data = JsonSerializer.Stringify(response);
OnSending(data);
return Context.Response.WriteAsync("id: " + response.MessageId + "\n" + "data: " + data + "\n\n");
}
开发者ID:praneethjonna,项目名称:SignalR,代码行数:7,代码来源:ServerSentEventsTransport.cs
示例2: Send
public override Task Send(PersistentResponse response)
{
var data = JsonSerializer.Stringify(response);
OnSending(data);
return _socket.Send(data);
}
开发者ID:rajjan,项目名称:SignalR,代码行数:8,代码来源:WebSocketTransport.cs
示例3: Send
public override void Send(PersistentResponse response)
{
Context.Response.Write("id: " + response.MessageId + "\n");
Context.Response.Write("data: " + JsonSerializer.Stringify(response) + "\n\n");
if (Context.Response.IsClientConnected)
{
Context.Response.Flush();
}
}
开发者ID:robinbetts,项目名称:SignalR,代码行数:9,代码来源:ServerSentEventsTransport.cs
示例4: Send
public override Task Send(PersistentResponse response)
{
var data = JsonSerializer.Stringify(response);
OnSending(data);
if (Context.Response.IsClientConnected)
{
return Context.Response.WriteAsync("id: " + response.MessageId + "\n" + "data: " + data + "\n\n");
}
return TaskAsyncHelper.Empty;
}
开发者ID:niik,项目名称:SignalR,代码行数:11,代码来源:ServerSentEventsTransport.cs
示例5: Send
public override Task Send(PersistentResponse response)
{
OnSendingResponse(response);
OutputWriter.Write("<script>r(c, ");
JsonSerializer.Serialize(response, OutputWriter);
OutputWriter.Write(");</script>\r\n");
OutputWriter.Flush();
return Context.Response.FlushAsync().Catch(IncrementErrorCounters);
}
开发者ID:slavah,项目名称:SignalR,代码行数:11,代码来源:ForeverFrameTransport.cs
示例6: Send
public override Task Send(PersistentResponse response)
{
var data = JsonSerializer.Stringify(response);
OnSending(data);
var script = "<script>r(c, " + data + ");</script>\r\n";
if (_isDebug)
{
script += "<div>" + data + "</div>\r\n";
}
return Context.Response.WriteAsync(script);
}
开发者ID:nightbob3,项目名称:SignalR,代码行数:13,代码来源:ForeverFrameTransport.cs
示例7: Send
public override Task Send(PersistentResponse response)
{
OnSendingResponse(response);
OutputWriter.Write("id: ");
OutputWriter.Write(response.MessageId);
OutputWriter.WriteLine();
OutputWriter.Write("data: ");
JsonSerializer.Serialize(response, OutputWriter);
OutputWriter.WriteLine();
OutputWriter.WriteLine();
OutputWriter.Flush();
return Context.Response.FlushAsync().Catch(IncrementErrorCounters);
}
开发者ID:slavah,项目名称:SignalR,代码行数:15,代码来源:ServerSentEventsTransport.cs
示例8: Send
public override Task Send(PersistentResponse response)
{
OnSendingResponse(response);
OutputWriter.Write("id: ");
OutputWriter.Write(response.MessageId);
OutputWriter.WriteLine();
OutputWriter.Write("data: ");
JsonSerializer.Stringify(response, OutputWriter);
OutputWriter.WriteLine();
OutputWriter.WriteLine();
OutputWriter.Flush();
return TaskAsyncHelper.Empty;
}
开发者ID:thoughtentity,项目名称:SignalR,代码行数:15,代码来源:ServerSentEventsTransport.cs
示例9: WriteJsonSkipsNullTransportDaa
public void WriteJsonSkipsNullTransportDaa()
{
// Arrange
var writer = new StringWriter();
var response = new PersistentResponse(m => m.Key == "key2");
response.Messages = new List<ArraySegment<Message>>();
response.MessageId = "Baz";
response.Messages.Add(new ArraySegment<Message>(new[] { new Message("1", "key", "value1"),
new Message("1", "key2", "value2") }, 0, 2));
// Act
((IJsonWritable)response).WriteJson(writer);
// Assert
Assert.Equal(@"{""MessageId"":""Baz"",""Disconnect"":false,""TimedOut"":false,""Messages"":[value1]}", writer.ToString());
}
开发者ID:nonintanon,项目名称:SignalR,代码行数:16,代码来源:PersistentResponseFacts.cs
示例10: Send
public override Task Send(PersistentResponse response)
{
var data = JsonSerializer.Stringify(response);
OnSending(data);
var script = String.Format(_sendTemplate, data);
if (_isDebug)
{
script += (String.Format(_debugTemplate, data));
}
if (Context.Response.IsClientConnected)
{
return Context.Response.WriteAsync(script);
}
return TaskAsyncHelper.Empty;
}
开发者ID:codeinpeace,项目名称:SignalR,代码行数:17,代码来源:ForeverFrameTransport.cs
示例11: Send
public override void Send(PersistentResponse response)
{
var payload = JsonSerializer.Stringify(response);
OnSending(payload);
var script = String.Format(_sendTemplate, payload);
Context.Response.Write(script);
if (_isDebug)
{
Context.Response.Write(String.Format(_debugTemplate, payload));
}
if (Context.Response.IsClientConnected)
{
Context.Response.Flush();
}
}
开发者ID:robinbetts,项目名称:SignalR,代码行数:18,代码来源:ForeverFrameTransport.cs
示例12: WriteJsonWritesSkipsCommands
public void WriteJsonWritesSkipsCommands()
{
// Arrange
var writer = new StringWriter();
var response = new PersistentResponse(m => false);
response.Messages = new List<ArraySegment<Message>>();
response.TransportData = new Dictionary<string, object>();
response.TransportData["Groups"] = new List<string>
{
"g1"
};
response.MessageId = "Baz";
response.Messages.Add(new ArraySegment<Message>(new[] { new Message("1", "key", "value1") { CommandId = "something"},
new Message("1", "key2", "value2") }, 0, 2));
// Act
((IJsonWritable)response).WriteJson(writer);
// Assert
Assert.Equal(@"{""MessageId"":""Baz"",""Disconnect"":false,""TimedOut"":false,""TransportData"":{""Groups"":[""g1""]},""Messages"":[value2]}", writer.ToString());
}
开发者ID:nonintanon,项目名称:SignalR,代码行数:21,代码来源:PersistentResponseFacts.cs
示例13: Send
public virtual Task Send(PersistentResponse response)
{
HeartBeat.MarkConnection(this);
var data = _jsonSerializer.Stringify(response);
OnSending(data);
return Context.Response.WriteAsync(data);
}
开发者ID:Tolli,项目名称:SignalR,代码行数:7,代码来源:ForeverTransport.cs
示例14: Send
public override Task Send(PersistentResponse response)
{
return Send((object)response);
}
开发者ID:slavah,项目名称:SignalR,代码行数:4,代码来源:WebSocketTransport.cs
示例15: AddTransportData
private void AddTransportData(PersistentResponse response)
{
if (LongPollDelay > 0)
{
if (response.TransportData == null)
{
response.TransportData = new Dictionary<string, object>();
}
response.TransportData["LongPollDelay"] = LongPollDelay;
}
}
开发者ID:thoughtentity,项目名称:SignalR,代码行数:11,代码来源:LongPollingTransport.cs
示例16: Send
public virtual Task Send(PersistentResponse response)
{
HeartBeat.MarkConnection(this);
if (SendingResponse != null)
{
SendingResponse(response);
}
AddTransportData(response);
return Send((object)response);
}
开发者ID:thoughtentity,项目名称:SignalR,代码行数:13,代码来源:LongPollingTransport.cs
示例17: OnSendingResponse
protected virtual void OnSendingResponse(PersistentResponse response)
{
HeartBeat.MarkConnection(this);
if (SendingResponse != null)
{
SendingResponse(response);
}
}
开发者ID:thoughtentity,项目名称:SignalR,代码行数:9,代码来源:ForeverTransport.cs
示例18: Send
public override Task Send(PersistentResponse response)
{
var data = JsonSerializer.Stringify(response);
OnSending(data);
return _socket.Send(data).Catch(IncrementErrorCounters);
}
开发者ID:TSASoftware,项目名称:SignalR,代码行数:8,代码来源:WebSocketTransport.cs
示例19: Send
public virtual void Send(PersistentResponse response)
{
Send((object)response);
}
开发者ID:robinbetts,项目名称:SignalR,代码行数:4,代码来源:ForeverTransport.cs
示例20: Send
public virtual void Send(PersistentResponse response)
{
_heartBeat.RemoveConnection(this);
AddTransportData(response);
Send((object)response);
}
开发者ID:abuhmead1987,项目名称:Presentations,代码行数:7,代码来源:LongPollingTransport.cs
注:本文中的PersistentResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论