Fix due to the renamed WebSocketServer<T> to WebSocketServiceHost<T>
This commit is contained in:
@@ -2,22 +2,27 @@ using System;
|
||||
using WebSocketSharp;
|
||||
using WebSocketSharp.Server;
|
||||
|
||||
namespace Example2
|
||||
{
|
||||
namespace Example2 {
|
||||
|
||||
public class Chat : WebSocketService
|
||||
{
|
||||
private static object _forId = new object();
|
||||
private static uint _id = 0;
|
||||
private static object _forNum = new object();
|
||||
private static uint _num = 0;
|
||||
|
||||
private string _name;
|
||||
|
||||
private string getName()
|
||||
{
|
||||
lock (_forId)
|
||||
return QueryString.Exists("name")
|
||||
? QueryString["name"]
|
||||
: "anon#" + getNum();
|
||||
}
|
||||
|
||||
private uint getNum()
|
||||
{
|
||||
lock (_forNum)
|
||||
{
|
||||
return QueryString.Exists("name")
|
||||
? QueryString["name"]
|
||||
: "anon#" + (++_id);
|
||||
return ++_num;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -8,22 +8,22 @@ namespace Example2
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
/* Single service server
|
||||
//var wssv = new WebSocketServer<Echo>("ws://localhost:4649");
|
||||
var wssv = new WebSocketServer<Echo>("ws://localhost:4649/Echo");
|
||||
//var wssv = new WebSocketServer<Echo>("ws://localhost:4649/エコー");
|
||||
//var wssv = new WebSocketServer<Echo>(4649);
|
||||
//var wssv = new WebSocketServer<Echo>(4649, "/Echo");
|
||||
//var wssv = new WebSocketServer<Echo>(4649, "/エコー");
|
||||
//var wssv = new WebSocketServer<Chat>("ws://localhost:4649");
|
||||
//var wssv = new WebSocketServer<Chat>("ws://localhost:4649/Chat");
|
||||
//var wssv = new WebSocketServer<Chat>("ws://localhost:4649/チャット");
|
||||
//var wssv = new WebSocketServer<Chat>(4649);
|
||||
//var wssv = new WebSocketServer<Chat>(4649, "/Chat");
|
||||
//var wssv = new WebSocketServer<Chat>(4649, "/チャット");
|
||||
//var wssv = new WebSocketServiceHost<Echo>("ws://localhost:4649");
|
||||
var wssv = new WebSocketServiceHost<Echo>("ws://localhost:4649/Echo");
|
||||
//var wssv = new WebSocketServiceHost<Echo>("ws://localhost:4649/エコー");
|
||||
//var wssv = new WebSocketServiceHost<Echo>(4649);
|
||||
//var wssv = new WebSocketServiceHost<Echo>(4649, "/Echo");
|
||||
//var wssv = new WebSocketServiceHost<Echo>(4649, "/エコー");
|
||||
//var wssv = new WebSocketServiceHost<Chat>("ws://localhost:4649");
|
||||
//var wssv = new WebSocketServiceHost<Chat>("ws://localhost:4649/Chat");
|
||||
//var wssv = new WebSocketServiceHost<Chat>("ws://localhost:4649/チャット");
|
||||
//var wssv = new WebSocketServiceHost<Chat>(4649);
|
||||
//var wssv = new WebSocketServiceHost<Chat>(4649, "/Chat");
|
||||
//var wssv = new WebSocketServiceHost<Chat>(4649, "/チャット");
|
||||
|
||||
wssv.Start();
|
||||
Console.WriteLine(
|
||||
"WebSocket Server (url: {0})\n listening on address: {1} port: {2}\n",
|
||||
"WebSocket Service Host (url: {0})\n listening on address: {1} port: {2}\n",
|
||||
wssv.Uri, wssv.Address, wssv.Port);
|
||||
*/
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user