websocket-sharp/Example3/Echo.cs

20 lines
401 B
C#
Raw Normal View History

2012-09-10 00:36:22 +08:00
using System;
using WebSocketSharp;
using WebSocketSharp.Server;
namespace Example3
{
2012-09-10 00:36:22 +08:00
public class Echo : WebSocketService
{
protected override void OnMessage (MessageEventArgs e)
2012-09-10 00:36:22 +08:00
{
2014-03-14 20:39:17 +08:00
var name = Context.QueryString ["name"];
var msg = !name.IsNullOrEmpty ()
2014-04-01 14:20:50 +08:00
? String.Format ("'{0}' to {1}", e.Data, name)
: e.Data;
Send (msg);
2012-09-10 00:36:22 +08:00
}
}
}