Refactored Example2
This commit is contained in:
@@ -12,16 +12,22 @@ namespace Example2
|
||||
public static void Main (string [] args)
|
||||
{
|
||||
var wssv = new WebSocketServer (4649);
|
||||
//var wssv = new WebSocketServer (4649, true);
|
||||
//var wssv = new WebSocketServer (4649, true); // Secure
|
||||
//var wssv = new WebSocketServer ("ws://localhost:4649");
|
||||
//var wssv = new WebSocketServer ("wss://localhost:4649");
|
||||
#if DEBUG
|
||||
wssv.Log.Level = LogLevel.TRACE;
|
||||
#endif
|
||||
//var wssv = new WebSocketServer ("wss://localhost:4649"); // Secure
|
||||
|
||||
// HTTP Basic/Digest Authentication
|
||||
/*
|
||||
wssv.AuthenticationSchemes = AuthenticationSchemes.Digest;
|
||||
#if DEBUG
|
||||
wssv.Log.Level = LogLevel.TRACE;
|
||||
#endif
|
||||
|
||||
/* Secure Connection
|
||||
var cert = ConfigurationManager.AppSettings ["ServerCertFile"];
|
||||
var password = ConfigurationManager.AppSettings ["CertFilePassword"];
|
||||
wssv.Certificate = new X509Certificate2 (cert, password);
|
||||
*/
|
||||
|
||||
/* HTTP Authentication (Basic/Digest)
|
||||
wssv.AuthenticationSchemes = AuthenticationSchemes.Basic;
|
||||
wssv.Realm = "WebSocket Test";
|
||||
wssv.UserCredentialsFinder = identity => {
|
||||
var name = identity.Name;
|
||||
@@ -31,20 +37,11 @@ namespace Example2
|
||||
};
|
||||
*/
|
||||
|
||||
// Secure Connection
|
||||
/*
|
||||
var cert = ConfigurationManager.AppSettings ["ServerCertFile"];
|
||||
var password = ConfigurationManager.AppSettings ["CertFilePassword"];
|
||||
wssv.Certificate = new X509Certificate2 (cert, password);
|
||||
*/
|
||||
|
||||
//wssv.KeepClean = false;
|
||||
|
||||
wssv.AddWebSocketService<Echo> ("/Echo");
|
||||
wssv.AddWebSocketService<Chat> ("/Chat");
|
||||
//wssv.AddWebSocketService<Chat> ("/Chat", () => new Chat ("Anon#"));
|
||||
//wssv.AddWebSocketService<Echo> ("/エコー");
|
||||
//wssv.AddWebSocketService<Chat> ("/チャット");
|
||||
|
||||
wssv.Start ();
|
||||
if (wssv.IsListening) {
|
||||
|
||||
Reference in New Issue
Block a user