Fix due to the modified ServiceManager.cs

This commit is contained in:
sta
2012-11-02 17:55:00 +09:00
parent 746c883b82
commit 2addc16f91
30 changed files with 65 additions and 11 deletions
Binary file not shown.
+2 -2
View File
@@ -73,11 +73,11 @@ namespace Example
ThreadPool.QueueUserWorkItem(notifyMsg);
using (WebSocket ws = new WebSocket("ws://echo.websocket.org", "echo"))
//using (WebSocket ws = new WebSocket("ws://echo.websocket.org", "echo"))
//using (WebSocket ws = new WebSocket("wss://echo.websocket.org", "echo"))
//using (WebSocket ws = new WebSocket("ws://localhost:4649"))
//using (WebSocket ws = new WebSocket("ws://localhost:4649/Echo"))
//using (WebSocket ws = new WebSocket("ws://localhost:4649/Echo?name=nobita"))
using (WebSocket ws = new WebSocket("ws://localhost:4649/Echo?name=nobita"))
//using (WebSocket ws = new WebSocket("ws://localhost:4649/エコー?name=のび太"))
//using (WebSocket ws = new WebSocket("ws://localhost:4649/Chat"))
//using (WebSocket ws = new WebSocket("ws://localhost:4649/Chat?name=nobita"))
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8 -5
View File
@@ -30,16 +30,19 @@ namespace Example2
/// Multi services server
var wssv = new WebSocketServer(4649);
//var wssv = new WebSocketServer("ws://localhost:4649");
//wssv.Sweeped = false; // Stop the Sweep inactive session Timer.
wssv.AddService<Echo>("/Echo");
wssv.AddService<Echo>("/エコー");
wssv.AddService<Chat>("/Chat");
wssv.AddService<Chat>("/チャット");
//wssv.Sweeped = false; // Must be set after any AddService methods done.
//wssv.AddService<Echo>("/エコー");
//wssv.AddService<Chat>("/チャット");
wssv.Start();
Console.WriteLine(
"WebSocket Server listening on port: {0}\n", wssv.Port);
"WebSocket Server listening on port: {0} service path:", wssv.Port);
foreach (var path in wssv.ServicePath)
Console.WriteLine(" {0}", path);
Console.WriteLine();
Console.WriteLine("Press any key to stop server...");
Console.ReadLine();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5 -2
View File
@@ -12,9 +12,9 @@ namespace Example3
public static void Main(string[] args)
{
_httpsv = new HttpServer(4649);
//_httpsv.Sweeped = false; // Stop the Sweep inactive session Timer.
_httpsv.AddService<Echo>("/Echo");
_httpsv.AddService<Chat>("/Chat");
//_httpsv.Sweeped = false; // Must be set after any AddService methods done.
_httpsv.OnGet += (sender, e) =>
{
@@ -27,7 +27,10 @@ namespace Example3
};
_httpsv.Start();
Console.WriteLine("HTTP Server listening on port: {0}\n", _httpsv.Port);
Console.WriteLine("HTTP Server listening on port: {0} service path:", _httpsv.Port);
foreach (var path in _httpsv.ServicePath)
Console.WriteLine(" {0}", path);
Console.WriteLine();
Console.WriteLine("Press any key to stop server...");
Console.ReadLine();
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
View File
@@ -27,6 +27,7 @@
#endregion
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
@@ -69,6 +70,12 @@ namespace WebSocketSharp.Server {
get { return _port; }
}
public IEnumerable<string> ServicePath {
get {
return _services.Path;
}
}
public bool Sweeped {
get {
return _services.Sweeped;
@@ -296,6 +303,10 @@ namespace WebSocketSharp.Server {
}
var svcHost = new WebSocketServiceHost<T>();
svcHost.Uri = absPath.ToUri();
if (!Sweeped)
svcHost.Sweeped = Sweeped;
_services.Add(absPath, svcHost);
}
+13 -1
View File
@@ -64,7 +64,7 @@ namespace WebSocketSharp.Server {
}
set {
if (value ^ _sweeped)
if (_sweeped ^ value)
{
_sweeped = value;
foreach (var svcHost in _services.Values)
@@ -73,6 +73,18 @@ namespace WebSocketSharp.Server {
}
}
public IEnumerable<string> Path {
get {
return _services.Keys;
}
}
public IEnumerable<IServiceHost> ServiceHost {
get {
return _services.Values;
}
}
#endregion
#region Public Methods
+17
View File
@@ -29,6 +29,7 @@
#endregion
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using WebSocketSharp.Net;
@@ -76,6 +77,16 @@ namespace WebSocketSharp.Server {
#region Property
public IEnumerable<string> ServicePath {
get {
var url = BaseUri.IsAbsoluteUri
? BaseUri.ToString().TrimEnd('/')
: String.Empty;
foreach (var path in _services.Path)
yield return url + path;
}
}
public bool Sweeped {
get {
return _services.Sweeped;
@@ -133,6 +144,12 @@ namespace WebSocketSharp.Server {
}
var svcHost = new WebSocketServiceHost<T>();
svcHost.Uri = BaseUri.IsAbsoluteUri
? new Uri(BaseUri, absPath)
: absPath.ToUri();
if (!Sweeped)
svcHost.Sweeped = Sweeped;
_services.Add(absPath, svcHost);
}
@@ -100,6 +100,10 @@ namespace WebSocketSharp.Server {
get {
return _uri;
}
set {
_uri = value;
}
}
#endregion
@@ -95,6 +95,10 @@ namespace WebSocketSharp.Server {
get {
return BaseUri;
}
internal set {
BaseUri = value;
}
}
#endregion
@@ -122,7 +126,7 @@ namespace WebSocketSharp.Server {
}
if (Uri.IsAbsoluteUri)
socket.Url = new Uri(Uri, path);
socket.Url = Uri;
BindWebSocket(socket);
}
Binary file not shown.
Binary file not shown.