2012-08-06 13:34:39 +08:00
|
|
|
using System;
|
|
|
|
using WebSocketSharp;
|
|
|
|
using WebSocketSharp.Server;
|
|
|
|
|
2013-08-08 14:12:29 +08:00
|
|
|
namespace Example2
|
|
|
|
{
|
2014-09-06 16:50:10 +08:00
|
|
|
public class Echo : WebSocketBehavior
|
2012-08-06 13:34:39 +08:00
|
|
|
{
|
2013-08-08 14:12:29 +08:00
|
|
|
protected override void OnMessage (MessageEventArgs e)
|
2012-09-03 10:55:52 +08:00
|
|
|
{
|
2022-01-22 16:52:21 +08:00
|
|
|
var name = QueryString["name"];
|
|
|
|
var msg = !name.IsNullOrEmpty ()
|
|
|
|
? String.Format ("\"{0}\" to {1}", e.Data, name)
|
|
|
|
: e.Data;
|
|
|
|
|
|
|
|
Send (msg);
|
2012-09-03 10:55:52 +08:00
|
|
|
}
|
2012-08-06 13:34:39 +08:00
|
|
|
}
|
|
|
|
}
|