本文整理汇总了C#中WebSocketSession.SendResponseAsync方法的典型用法代码示例。如果您正苦于以下问题:C# WebSocketSession.SendResponseAsync方法的具体用法?C# WebSocketSession.SendResponseAsync怎么用?C# WebSocketSession.SendResponseAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebSocketSession
的用法示例。
在下文中一共展示了WebSocketSession.SendResponseAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessResponse
public void ProcessResponse(ConsoleCommand command, WebSocketSession session)
{
_session = session;
try
{
var args = command.CommandText.SplitCommandLine().ToArray();
_commands.Parse(args);
}
catch(MissingCommandArgumentException e) //An invalid option was passed
{
var response = Help();
response.PrependMessage(e.Message);
session.SendResponseAsync(response.Serialize());
}
}
示例2: socketServer_NewMessageReceived
void socketServer_NewMessageReceived(WebSocketSession session, string e)
{
var command = JsonConvert.DeserializeObject<ConsoleCommand>(e);
try
{
IConsoleResponder r = new ConsoleResponder(SendToAll);
r.ProcessResponse(command, session);
}
catch(Exception ex)
{
var response = new ConsoleCommandResponse();
response.AppendMessage("Server Error! :(");
response.AppendMessage(ex.Message);
session.SendResponseAsync(response.Serialize());
}
}