Renamed SessionManager.cs to WebSocketServiceManager.cs
parent
a171b05740
commit
fcdf214fc0
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.
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.
@ -1,312 +0,0 @@
|
|||||||
#region MIT License
|
|
||||||
/*
|
|
||||||
* SessionManager.cs
|
|
||||||
*
|
|
||||||
* The MIT License
|
|
||||||
*
|
|
||||||
* Copyright (c) 2012-2013 sta.blockhead
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Timers;
|
|
||||||
|
|
||||||
namespace WebSocketSharp.Server {
|
|
||||||
|
|
||||||
public class SessionManager {
|
|
||||||
|
|
||||||
#region Private Fields
|
|
||||||
|
|
||||||
private object _forSweep;
|
|
||||||
private volatile bool _isStopped;
|
|
||||||
private volatile bool _isSweeping;
|
|
||||||
private Dictionary<string, WebSocketService> _sessions;
|
|
||||||
private Timer _sweepTimer;
|
|
||||||
private object _syncRoot;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Public Constructor
|
|
||||||
|
|
||||||
public SessionManager()
|
|
||||||
{
|
|
||||||
_forSweep = new object();
|
|
||||||
_isStopped = false;
|
|
||||||
_isSweeping = false;
|
|
||||||
_sessions = new Dictionary<string, WebSocketService>();
|
|
||||||
_sweepTimer = new Timer(60 * 1000);
|
|
||||||
_sweepTimer.Elapsed += (sender, e) =>
|
|
||||||
{
|
|
||||||
Sweep();
|
|
||||||
};
|
|
||||||
_syncRoot = new object();
|
|
||||||
|
|
||||||
startSweepTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
|
|
||||||
public IEnumerable<string> ActiveID {
|
|
||||||
get {
|
|
||||||
return from result in Broadping(String.Empty)
|
|
||||||
where result.Value
|
|
||||||
select result.Key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Count {
|
|
||||||
get {
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
return _sessions.Count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> InactiveID {
|
|
||||||
get {
|
|
||||||
return from result in Broadping(String.Empty)
|
|
||||||
where !result.Value
|
|
||||||
select result.Key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> ID {
|
|
||||||
get {
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
return _sessions.Keys;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Sweeped {
|
|
||||||
get {
|
|
||||||
return _sweepTimer.Enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
set {
|
|
||||||
if (value && !_isStopped)
|
|
||||||
startSweepTimer();
|
|
||||||
|
|
||||||
if (!value)
|
|
||||||
stopSweepTimer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public object SyncRoot {
|
|
||||||
get {
|
|
||||||
return _syncRoot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Private Methods
|
|
||||||
|
|
||||||
private void broadcast(byte[] data)
|
|
||||||
{
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
foreach (var service in _sessions.Values)
|
|
||||||
service.Send(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void broadcast(string data)
|
|
||||||
{
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
foreach (var service in _sessions.Values)
|
|
||||||
service.Send(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void broadcastAsync(byte[] data)
|
|
||||||
{
|
|
||||||
var sessions = copySessions();
|
|
||||||
var services = sessions.Values.GetEnumerator();
|
|
||||||
|
|
||||||
Action completed = null;
|
|
||||||
completed = () =>
|
|
||||||
{
|
|
||||||
if (services.MoveNext())
|
|
||||||
services.Current.SendAsync(data, completed);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (services.MoveNext())
|
|
||||||
services.Current.SendAsync(data, completed);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void broadcastAsync(string data)
|
|
||||||
{
|
|
||||||
var sessions = copySessions();
|
|
||||||
var services = sessions.Values.GetEnumerator();
|
|
||||||
|
|
||||||
Action completed = null;
|
|
||||||
completed = () =>
|
|
||||||
{
|
|
||||||
if (services.MoveNext())
|
|
||||||
services.Current.SendAsync(data, completed);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (services.MoveNext())
|
|
||||||
services.Current.SendAsync(data, completed);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Dictionary<string, WebSocketService> copySessions()
|
|
||||||
{
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
return new Dictionary<string, WebSocketService>(_sessions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string createID()
|
|
||||||
{
|
|
||||||
return Guid.NewGuid().ToString("N");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startSweepTimer()
|
|
||||||
{
|
|
||||||
if (!Sweeped)
|
|
||||||
_sweepTimer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopSweepTimer()
|
|
||||||
{
|
|
||||||
if (Sweeped)
|
|
||||||
_sweepTimer.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Public Methods
|
|
||||||
|
|
||||||
public string Add(WebSocketService service)
|
|
||||||
{
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
if (_isStopped)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
var id = createID();
|
|
||||||
_sessions.Add(id, service);
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Broadcast(byte[] data)
|
|
||||||
{
|
|
||||||
if (_isStopped)
|
|
||||||
broadcast(data);
|
|
||||||
else
|
|
||||||
broadcastAsync(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Broadcast(string data)
|
|
||||||
{
|
|
||||||
if (_isStopped)
|
|
||||||
broadcast(data);
|
|
||||||
else
|
|
||||||
broadcastAsync(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<string, bool> Broadping(string message)
|
|
||||||
{
|
|
||||||
var result = new Dictionary<string, bool>();
|
|
||||||
foreach (var session in copySessions())
|
|
||||||
result.Add(session.Key, session.Value.Ping(message));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Remove(string id)
|
|
||||||
{
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
return _sessions.Remove(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool TryGetByID(string id, out WebSocketService service)
|
|
||||||
{
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
return _sessions.TryGetValue(id, out service);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
|
||||||
Stop(CloseStatusCode.NORMAL, String.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop(CloseStatusCode code, string reason)
|
|
||||||
{
|
|
||||||
stopSweepTimer();
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
if (_isStopped)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_isStopped = true;
|
|
||||||
foreach (var service in copySessions().Values)
|
|
||||||
service.Stop(code, reason);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Sweep()
|
|
||||||
{
|
|
||||||
if (_isStopped || _isSweeping || Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
lock (_forSweep)
|
|
||||||
{
|
|
||||||
_isSweeping = true;
|
|
||||||
foreach (var id in InactiveID)
|
|
||||||
{
|
|
||||||
lock (_syncRoot)
|
|
||||||
{
|
|
||||||
if (_isStopped)
|
|
||||||
{
|
|
||||||
_isSweeping = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WebSocketService service;
|
|
||||||
if (TryGetByID(id, out service))
|
|
||||||
service.Stop(CloseStatusCode.ABNORMAL, String.Empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_isSweeping = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,408 @@
|
|||||||
|
#region MIT License
|
||||||
|
/*
|
||||||
|
* WebSocketServiceManager.cs
|
||||||
|
*
|
||||||
|
* The MIT License
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012-2013 sta.blockhead
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Timers;
|
||||||
|
|
||||||
|
namespace WebSocketSharp.Server {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Manages the collection of <see cref="WebSocketService"/> objects.
|
||||||
|
/// </summary>
|
||||||
|
public class WebSocketServiceManager {
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
private object _forSweep;
|
||||||
|
private volatile bool _isStopped;
|
||||||
|
private volatile bool _isSweeping;
|
||||||
|
private Dictionary<string, WebSocketService> _services;
|
||||||
|
private Timer _sweepTimer;
|
||||||
|
private object _syncRoot;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
internal WebSocketServiceManager()
|
||||||
|
{
|
||||||
|
_forSweep = new object();
|
||||||
|
_isStopped = false;
|
||||||
|
_isSweeping = false;
|
||||||
|
_services = new Dictionary<string, WebSocketService>();
|
||||||
|
_syncRoot = new object();
|
||||||
|
|
||||||
|
setSweepTimer();
|
||||||
|
startSweepTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the collection of IDs of active <see cref="WebSocketService"/> objects
|
||||||
|
/// managed by the <see cref="WebSocketServiceManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// An IEnumerable<string> that contains the collection of IDs of active <see cref="WebSocketService"/> objects.
|
||||||
|
/// </value>
|
||||||
|
public IEnumerable<string> ActiveIDs {
|
||||||
|
get {
|
||||||
|
return from result in Broadping(String.Empty)
|
||||||
|
where result.Value
|
||||||
|
select result.Key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of <see cref="WebSocketService"/> objects
|
||||||
|
/// managed by the <see cref="WebSocketServiceManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// An <see cref="int"/> that contains the number of <see cref="WebSocketService"/> objects
|
||||||
|
/// managed by the <see cref="WebSocketServiceManager"/>.
|
||||||
|
/// </value>
|
||||||
|
public int Count {
|
||||||
|
get {
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
return _services.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the collection of IDs of inactive <see cref="WebSocketService"/> objects
|
||||||
|
/// managed by the <see cref="WebSocketServiceManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// An IEnumerable<string> that contains the collection of IDs of inactive <see cref="WebSocketService"/> objects.
|
||||||
|
/// </value>
|
||||||
|
public IEnumerable<string> InactiveIDs {
|
||||||
|
get {
|
||||||
|
return from result in Broadping(String.Empty)
|
||||||
|
where !result.Value
|
||||||
|
select result.Key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the collection of IDs of <see cref="WebSocketService"/> objects
|
||||||
|
/// managed by the <see cref="WebSocketServiceManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// An IEnumerable<string> that contains the collection of IDs of <see cref="WebSocketService"/> objects.
|
||||||
|
/// </value>
|
||||||
|
public IEnumerable<string> IDs {
|
||||||
|
get {
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
return _services.Keys;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether the <see cref="WebSocketServiceManager"/> cleans up
|
||||||
|
/// the inactive <see cref="WebSocketService"/> objects periodically.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// <c>true</c> if the <see cref="WebSocketServiceManager"/> cleans up the inactive <see cref="WebSocketService"/> objects
|
||||||
|
/// every 60 seconds; otherwise, <c>false</c>.
|
||||||
|
/// </value>
|
||||||
|
public bool Sweeped {
|
||||||
|
get {
|
||||||
|
return _sweepTimer.Enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal set {
|
||||||
|
if (value && !_isStopped)
|
||||||
|
startSweepTimer();
|
||||||
|
|
||||||
|
if (!value)
|
||||||
|
stopSweepTimer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private Methods
|
||||||
|
|
||||||
|
private void broadcast(byte[] data)
|
||||||
|
{
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
foreach (var service in _services.Values)
|
||||||
|
service.Send(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void broadcast(string data)
|
||||||
|
{
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
foreach (var service in _services.Values)
|
||||||
|
service.Send(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void broadcastAsync(byte[] data)
|
||||||
|
{
|
||||||
|
var copied = copy();
|
||||||
|
var services = copied.Values.GetEnumerator();
|
||||||
|
|
||||||
|
Action completed = null;
|
||||||
|
completed = () =>
|
||||||
|
{
|
||||||
|
if (services.MoveNext())
|
||||||
|
services.Current.SendAsync(data, completed);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (services.MoveNext())
|
||||||
|
services.Current.SendAsync(data, completed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void broadcastAsync(string data)
|
||||||
|
{
|
||||||
|
var copied = copy();
|
||||||
|
var services = copied.Values.GetEnumerator();
|
||||||
|
|
||||||
|
Action completed = null;
|
||||||
|
completed = () =>
|
||||||
|
{
|
||||||
|
if (services.MoveNext())
|
||||||
|
services.Current.SendAsync(data, completed);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (services.MoveNext())
|
||||||
|
services.Current.SendAsync(data, completed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Dictionary<string, WebSocketService> copy()
|
||||||
|
{
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
return new Dictionary<string, WebSocketService>(_services);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string createID()
|
||||||
|
{
|
||||||
|
return Guid.NewGuid().ToString("N");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSweepTimer()
|
||||||
|
{
|
||||||
|
_sweepTimer = new Timer(60 * 1000);
|
||||||
|
_sweepTimer.Elapsed += (sender, e) =>
|
||||||
|
{
|
||||||
|
Sweep();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startSweepTimer()
|
||||||
|
{
|
||||||
|
if (!Sweeped)
|
||||||
|
_sweepTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stop(ushort code, string reason, bool ignoreArgs)
|
||||||
|
{
|
||||||
|
stopSweepTimer();
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
if (_isStopped)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_isStopped = true;
|
||||||
|
foreach (var service in copy().Values)
|
||||||
|
if (ignoreArgs)
|
||||||
|
service.Stop();
|
||||||
|
else
|
||||||
|
service.Stop(code, reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopSweepTimer()
|
||||||
|
{
|
||||||
|
if (Sweeped)
|
||||||
|
_sweepTimer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Internal Methods
|
||||||
|
|
||||||
|
internal string Add(WebSocketService service)
|
||||||
|
{
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
if (_isStopped)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var id = createID();
|
||||||
|
_services.Add(id, service);
|
||||||
|
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal bool Remove(string id)
|
||||||
|
{
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
return _services.Remove(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Stop()
|
||||||
|
{
|
||||||
|
stop(0, null, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Stop(ushort code, string reason)
|
||||||
|
{
|
||||||
|
stop(code, reason, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Stop(CloseStatusCode code, string reason)
|
||||||
|
{
|
||||||
|
Stop((ushort)code, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Broadcasts the specified array of <see cref="byte"/> to the clients of every <see cref="WebSocketService"/>
|
||||||
|
/// managed by the <see cref="WebSocketServiceManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">
|
||||||
|
/// An array of <see cref="byte"/> to broadcast.
|
||||||
|
/// </param>
|
||||||
|
public void Broadcast(byte[] data)
|
||||||
|
{
|
||||||
|
if (_isStopped)
|
||||||
|
broadcast(data);
|
||||||
|
else
|
||||||
|
broadcastAsync(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Broadcasts the specified <see cref="string"/> to the clients of every <see cref="WebSocketService"/>
|
||||||
|
/// managed by the <see cref="WebSocketServiceManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">
|
||||||
|
/// A <see cref="string"/> to broadcast.
|
||||||
|
/// </param>
|
||||||
|
public void Broadcast(string data)
|
||||||
|
{
|
||||||
|
if (_isStopped)
|
||||||
|
broadcast(data);
|
||||||
|
else
|
||||||
|
broadcastAsync(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pings with the specified <see cref="string"/> to the clients of every <see cref="WebSocketService"/>
|
||||||
|
/// managed by the <see cref="WebSocketServiceManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>
|
||||||
|
/// A Dictionary<string, bool> that contains the collection of IDs and values
|
||||||
|
/// indicating whether each <see cref="WebSocketService"/> received a Pong in a time.
|
||||||
|
/// </returns>
|
||||||
|
/// <param name="message">
|
||||||
|
/// A <see cref="string"/> that contains a message.
|
||||||
|
/// </param>
|
||||||
|
public Dictionary<string, bool> Broadping(string message)
|
||||||
|
{
|
||||||
|
var result = new Dictionary<string, bool>();
|
||||||
|
foreach (var session in copy())
|
||||||
|
result.Add(session.Key, session.Value.Ping(message));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cleans up the inactive <see cref="WebSocketService"/> objects.
|
||||||
|
/// </summary>
|
||||||
|
public void Sweep()
|
||||||
|
{
|
||||||
|
if (_isStopped || _isSweeping || Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lock (_forSweep)
|
||||||
|
{
|
||||||
|
_isSweeping = true;
|
||||||
|
foreach (var id in InactiveIDs)
|
||||||
|
{
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
if (_isStopped)
|
||||||
|
{
|
||||||
|
_isSweeping = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
WebSocketService service;
|
||||||
|
if (TryGetWebSocketService(id, out service))
|
||||||
|
service.Stop(CloseStatusCode.ABNORMAL, String.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_isSweeping = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tries to get the <see cref="WebSocketService"/> associated with the specified <paramref name="id"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>
|
||||||
|
/// <c>true</c> if the <see cref="WebSocketServiceManager"/> manages the <see cref="WebSocketService"/> with the specified <paramref name="id"/>; otherwise, <c>false</c>.
|
||||||
|
/// </returns>
|
||||||
|
/// <param name="id">
|
||||||
|
/// A <see cref="string"/> that contains the ID to find.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="service">
|
||||||
|
/// When this method returns, contains the <see cref="WebSocketService"/> with the specified <paramref name="id"/>, if the <paramref name="id"/> is found; otherwise, <see langword="null"/>.
|
||||||
|
/// </param>
|
||||||
|
public bool TryGetWebSocketService(string id, out WebSocketService service)
|
||||||
|
{
|
||||||
|
lock (_syncRoot)
|
||||||
|
{
|
||||||
|
return _services.TryGetValue(id, out service);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,672 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>WebSocketSharp.Server.WebSocketServiceManager</title>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<style>
|
||||||
|
a { text-decoration: none }
|
||||||
|
|
||||||
|
div.SideBar {
|
||||||
|
padding-left: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
|
right: 0;
|
||||||
|
float: right;
|
||||||
|
border: thin solid black;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CollectionTitle { font-weight: bold }
|
||||||
|
.PageTitle { font-size: 150%; font-weight: bold }
|
||||||
|
|
||||||
|
.Summary { }
|
||||||
|
.Signature { }
|
||||||
|
.Remarks { }
|
||||||
|
.Members { }
|
||||||
|
.Copyright { }
|
||||||
|
|
||||||
|
.Section { font-size: 125%; font-weight: bold }
|
||||||
|
p.Summary {
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
.SectionBox { margin-left: 2em }
|
||||||
|
.NamespaceName { font-size: 105%; font-weight: bold }
|
||||||
|
.NamespaceSumary { }
|
||||||
|
.MemberName { font-size: 115%; font-weight: bold; margin-top: 1em }
|
||||||
|
.Subsection { font-size: 105%; font-weight: bold }
|
||||||
|
.SubsectionBox { margin-left: 2em; margin-bottom: 1em }
|
||||||
|
|
||||||
|
.CodeExampleTable { background-color: #f5f5dd; border: thin solid black; padding: .25em; }
|
||||||
|
|
||||||
|
.TypesListing {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.TypesListing td {
|
||||||
|
margin: 0px;
|
||||||
|
padding: .25em;
|
||||||
|
border: solid gray 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.TypesListing th {
|
||||||
|
margin: 0px;
|
||||||
|
padding: .25em;
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
border: solid gray 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.Footer {
|
||||||
|
border-top: 1px solid gray;
|
||||||
|
margin-top: 1.5em;
|
||||||
|
padding-top: 0.6em;
|
||||||
|
text-align: center;
|
||||||
|
color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.NotEntered /* Documentation for this section has not yet been entered */ {
|
||||||
|
font-style: italic;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.Header {
|
||||||
|
background: #B0C4DE;
|
||||||
|
border: double;
|
||||||
|
border-color: white;
|
||||||
|
border-width: 7px;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.Header * {
|
||||||
|
font-size: smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.Note {
|
||||||
|
}
|
||||||
|
|
||||||
|
i.ParamRef {
|
||||||
|
}
|
||||||
|
|
||||||
|
i.subtitle {
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.TypeMembersIndex {
|
||||||
|
text-align: left;
|
||||||
|
background: #F8F8F8;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.TypeMembersIndex li {
|
||||||
|
display: inline;
|
||||||
|
margin: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.HeaderTable {
|
||||||
|
}
|
||||||
|
|
||||||
|
table.SignatureTable {
|
||||||
|
}
|
||||||
|
|
||||||
|
table.Documentation, table.Enumeration, table.TypeDocumentation {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.Documentation tr th, table.TypeMembers tr th, table.Enumeration tr th, table.TypeDocumentation tr th {
|
||||||
|
background: whitesmoke;
|
||||||
|
padding: 0.8em;
|
||||||
|
border: 1px solid gray;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.Documentation tr td, table.TypeMembers tr td, table.Enumeration tr td, table.TypeDocumentation tr td {
|
||||||
|
padding: 0.5em;
|
||||||
|
border: 1px solid gray;
|
||||||
|
text-align: left;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.TypeMembers {
|
||||||
|
border: 1px solid #C0C0C0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.TypeMembers tr td {
|
||||||
|
background: #F8F8F8;
|
||||||
|
border: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.Documentation {
|
||||||
|
}
|
||||||
|
|
||||||
|
table.TypeMembers {
|
||||||
|
}
|
||||||
|
|
||||||
|
div.CodeExample {
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #DDDDDD;
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.CodeExample p {
|
||||||
|
margin: 0.5em;
|
||||||
|
border-bottom: 1px solid #DDDDDD;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.CodeExample div {
|
||||||
|
margin: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.Signature {
|
||||||
|
border: 1px solid #C0C0C0;
|
||||||
|
background: #F2F2F2;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script type="text/JavaScript">
|
||||||
|
function toggle_display (block) {
|
||||||
|
var w = document.getElementById (block);
|
||||||
|
var t = document.getElementById (block + ":toggle");
|
||||||
|
if (w.style.display == "none") {
|
||||||
|
w.style.display = "block";
|
||||||
|
t.innerHTML = "⊟";
|
||||||
|
} else {
|
||||||
|
w.style.display = "none";
|
||||||
|
t.innerHTML = "⊞";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="CollectionTitle">
|
||||||
|
<a href="../index.html">websocket-sharp</a> : <a href="index.html">WebSocketSharp.Server Namespace</a></div>
|
||||||
|
<div class="SideBar">
|
||||||
|
<p>
|
||||||
|
<a href="#T:WebSocketSharp.Server.WebSocketServiceManager">Overview</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="#T:WebSocketSharp.Server.WebSocketServiceManager:Signature">Signature</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="#T:WebSocketSharp.Server.WebSocketServiceManager:Docs">Remarks</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="#Members">Members</a>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<a href="#T:WebSocketSharp.Server.WebSocketServiceManager:Members">Member Details</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<h1 class="PageTitle" id="T:WebSocketSharp.Server.WebSocketServiceManager">WebSocketServiceManager Class</h1>
|
||||||
|
<p class="Summary" id="T:WebSocketSharp.Server.WebSocketServiceManager:Summary">
|
||||||
|
Manages the collection of <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects.
|
||||||
|
</p>
|
||||||
|
<div id="T:WebSocketSharp.Server.WebSocketServiceManager:Signature">
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public class <b>WebSocketServiceManager</b></div>
|
||||||
|
</div>
|
||||||
|
<div class="Remarks" id="T:WebSocketSharp.Server.WebSocketServiceManager:Docs">
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="T:WebSocketSharp.Server.WebSocketServiceManager:Docs:Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="T:WebSocketSharp.Server.WebSocketServiceManager:Docs:Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<h2 class="Section" id="Members">Members</h2>
|
||||||
|
<div class="SectionBox" id="_Members">
|
||||||
|
<p>
|
||||||
|
See Also: Inherited members from
|
||||||
|
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Object">object</a>.
|
||||||
|
</p>
|
||||||
|
<h2 class="Section">Public Properties</h2>
|
||||||
|
<div class="SectionBox" id="Public Properties">
|
||||||
|
<div class="SubsectionBox">
|
||||||
|
<table class="TypeMembers">
|
||||||
|
<tr valign="top">
|
||||||
|
<td>[read-only]<div></div></td>
|
||||||
|
<td>
|
||||||
|
<b>
|
||||||
|
<a href="#P:WebSocketSharp.Server.WebSocketServiceManager.ActiveIDs">ActiveIDs</a>
|
||||||
|
</b>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i>
|
||||||
|
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<string></a>
|
||||||
|
</i>.
|
||||||
|
Gets the collection of IDs of active <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>[read-only]<div></div></td>
|
||||||
|
<td>
|
||||||
|
<b>
|
||||||
|
<a href="#P:WebSocketSharp.Server.WebSocketServiceManager.Count">Count</a>
|
||||||
|
</b>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i>
|
||||||
|
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32">int</a>
|
||||||
|
</i>.
|
||||||
|
Gets the number of <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>[read-only]<div></div></td>
|
||||||
|
<td>
|
||||||
|
<b>
|
||||||
|
<a href="#P:WebSocketSharp.Server.WebSocketServiceManager.IDs">IDs</a>
|
||||||
|
</b>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i>
|
||||||
|
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<string></a>
|
||||||
|
</i>.
|
||||||
|
Gets the collection of IDs of <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>[read-only]<div></div></td>
|
||||||
|
<td>
|
||||||
|
<b>
|
||||||
|
<a href="#P:WebSocketSharp.Server.WebSocketServiceManager.InactiveIDs">InactiveIDs</a>
|
||||||
|
</b>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i>
|
||||||
|
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<string></a>
|
||||||
|
</i>.
|
||||||
|
Gets the collection of IDs of inactive <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>[read-only]<div></div></td>
|
||||||
|
<td>
|
||||||
|
<b>
|
||||||
|
<a href="#P:WebSocketSharp.Server.WebSocketServiceManager.Sweeped">Sweeped</a>
|
||||||
|
</b>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i>
|
||||||
|
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a>
|
||||||
|
</i>.
|
||||||
|
Gets a value indicating whether the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a> cleans up
|
||||||
|
the inactive <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects periodically.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Public Methods</h2>
|
||||||
|
<div class="SectionBox" id="Public Methods">
|
||||||
|
<div class="SubsectionBox">
|
||||||
|
<table class="TypeMembers">
|
||||||
|
<tr valign="top">
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2">
|
||||||
|
<b>
|
||||||
|
<a href="#M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.Byte[])">Broadcast</a>
|
||||||
|
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[])<blockquote>
|
||||||
|
Broadcasts the specified array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a> to the clients of every <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a>
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</blockquote></td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2">
|
||||||
|
<b>
|
||||||
|
<a href="#M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.String)">Broadcast</a>
|
||||||
|
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>)<blockquote>
|
||||||
|
Broadcasts the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> to the clients of every <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a>
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</blockquote></td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2">
|
||||||
|
<b>
|
||||||
|
<a href="#M:WebSocketSharp.Server.WebSocketServiceManager.Broadping(System.String)">Broadping</a>
|
||||||
|
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.Dictionary`2">Dictionary<string, bool></a></nobr><blockquote>
|
||||||
|
Pings with the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> to the clients of every <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a>
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</blockquote></td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2">
|
||||||
|
<b>
|
||||||
|
<a href="#M:WebSocketSharp.Server.WebSocketServiceManager.Sweep">Sweep</a>
|
||||||
|
</b>()<blockquote>
|
||||||
|
Cleans up the inactive <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects.
|
||||||
|
</blockquote></td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2">
|
||||||
|
<b>
|
||||||
|
<a href="#M:WebSocketSharp.Server.WebSocketServiceManager.TryGetWebSocketService(System.String,WebSocketSharp.Server.WebSocketService@)">TryGetWebSocketService</a>
|
||||||
|
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>, <i>out</i> <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketService</a>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a></nobr><blockquote>
|
||||||
|
Tries to get the <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> associated with the specified <i>id</i>.
|
||||||
|
</blockquote></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Extension Methods</h2>
|
||||||
|
<div class="SectionBox" id="Extension Methods">
|
||||||
|
<div class="SubsectionBox">
|
||||||
|
<table class="TypeMembers">
|
||||||
|
<tr valign="top">
|
||||||
|
<td>
|
||||||
|
<div>static </div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2">
|
||||||
|
<b>
|
||||||
|
<a href="../WebSocketSharp/Ext.html#M:WebSocketSharp.Ext.IsNull``1(``0)">IsNull<T></a>
|
||||||
|
</b>(<i>this</i> <i title="
 The type of the parameter.
 ">T</i>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a></nobr><blockquote>
|
||||||
|
Determines whether the specified object is <tt>null</tt>.
|
||||||
|
</blockquote></td>
|
||||||
|
</tr>
|
||||||
|
<tr valign="top">
|
||||||
|
<td>
|
||||||
|
<div>static </div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2">
|
||||||
|
<b>
|
||||||
|
<a href="../WebSocketSharp/Ext.html#M:WebSocketSharp.Ext.IsNullDo``1(``0,System.Action)">IsNullDo<T></a>
|
||||||
|
</b>(<i>this</i> <i title="
 The type of the parameter.
 ">T</i>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a></nobr><blockquote>
|
||||||
|
Determines whether the specified object is <tt>null</tt>.
|
||||||
|
And invokes the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate if the specified object is <tt>null</tt>.
|
||||||
|
</blockquote></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="Members" id="T:WebSocketSharp.Server.WebSocketServiceManager:Members">
|
||||||
|
<h2 class="Section" id="MemberDetails">Member Details</h2>
|
||||||
|
<div class="SectionBox" id="_MemberDetails">
|
||||||
|
<h3 id="P:WebSocketSharp.Server.WebSocketServiceManager.ActiveIDs">ActiveIDs Property</h3>
|
||||||
|
<blockquote id="P:WebSocketSharp.Server.WebSocketServiceManager.ActiveIDs:member">
|
||||||
|
<p class="Summary">
|
||||||
|
Gets the collection of IDs of active <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<string></a> <b>ActiveIDs</b> { get; }</div>
|
||||||
|
<h4 class="Subsection">Value</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.ActiveIDs:Value">
|
||||||
|
An IEnumerable<string> that contains the collection of IDs of active <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects.
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.ActiveIDs:Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.ActiveIDs:Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.Byte[])">Broadcast Method</h3>
|
||||||
|
<blockquote id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.Byte[]):member">
|
||||||
|
<p class="Summary">
|
||||||
|
Broadcasts the specified array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a> to the clients of every <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a>
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Broadcast</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[] data)</div>
|
||||||
|
<h4 class="Subsection">Parameters</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.Byte[]):Parameters">
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
<i>data</i>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
An array of <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a> to broadcast.
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.Byte[]):Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.Byte[]):Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.String)">Broadcast Method</h3>
|
||||||
|
<blockquote id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.String):member">
|
||||||
|
<p class="Summary">
|
||||||
|
Broadcasts the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> to the clients of every <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a>
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Broadcast</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> data)</div>
|
||||||
|
<h4 class="Subsection">Parameters</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.String):Parameters">
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
<i>data</i>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> to broadcast.
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.String):Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadcast(System.String):Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadping(System.String)">Broadping Method</h3>
|
||||||
|
<blockquote id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadping(System.String):member">
|
||||||
|
<p class="Summary">
|
||||||
|
Pings with the specified <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> to the clients of every <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a>
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.Dictionary`2">Dictionary<string, bool></a> <b>Broadping</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> message)</div>
|
||||||
|
<h4 class="Subsection">Parameters</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadping(System.String):Parameters">
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
<i>message</i>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains a message.
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</blockquote>
|
||||||
|
<h4 class="Subsection">Returns</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadping(System.String):Returns">
|
||||||
|
A Dictionary<string, bool> that contains the collection of IDs and values
|
||||||
|
indicating whether each <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> received a Pong in a time.
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadping(System.String):Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Broadping(System.String):Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="P:WebSocketSharp.Server.WebSocketServiceManager.Count">Count Property</h3>
|
||||||
|
<blockquote id="P:WebSocketSharp.Server.WebSocketServiceManager.Count:member">
|
||||||
|
<p class="Summary">
|
||||||
|
Gets the number of <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32">int</a> <b>Count</b> { get; }</div>
|
||||||
|
<h4 class="Subsection">Value</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.Count:Value">
|
||||||
|
An <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32">int</a> that contains the number of <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.Count:Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.Count:Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="P:WebSocketSharp.Server.WebSocketServiceManager.IDs">IDs Property</h3>
|
||||||
|
<blockquote id="P:WebSocketSharp.Server.WebSocketServiceManager.IDs:member">
|
||||||
|
<p class="Summary">
|
||||||
|
Gets the collection of IDs of <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<string></a> <b>IDs</b> { get; }</div>
|
||||||
|
<h4 class="Subsection">Value</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.IDs:Value">
|
||||||
|
An IEnumerable<string> that contains the collection of IDs of <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects.
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.IDs:Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.IDs:Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="P:WebSocketSharp.Server.WebSocketServiceManager.InactiveIDs">InactiveIDs Property</h3>
|
||||||
|
<blockquote id="P:WebSocketSharp.Server.WebSocketServiceManager.InactiveIDs:member">
|
||||||
|
<p class="Summary">
|
||||||
|
Gets the collection of IDs of inactive <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
managed by the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a>.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<string></a> <b>InactiveIDs</b> { get; }</div>
|
||||||
|
<h4 class="Subsection">Value</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.InactiveIDs:Value">
|
||||||
|
An IEnumerable<string> that contains the collection of IDs of inactive <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects.
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.InactiveIDs:Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.InactiveIDs:Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="M:WebSocketSharp.Server.WebSocketServiceManager.Sweep">Sweep Method</h3>
|
||||||
|
<blockquote id="M:WebSocketSharp.Server.WebSocketServiceManager.Sweep:member">
|
||||||
|
<p class="Summary">
|
||||||
|
Cleans up the inactive <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Sweep</b> ()</div>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Sweep:Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.Sweep:Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="P:WebSocketSharp.Server.WebSocketServiceManager.Sweeped">Sweeped Property</h3>
|
||||||
|
<blockquote id="P:WebSocketSharp.Server.WebSocketServiceManager.Sweeped:member">
|
||||||
|
<p class="Summary">
|
||||||
|
Gets a value indicating whether the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a> cleans up
|
||||||
|
the inactive <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects periodically.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a> <b>Sweeped</b> { get; }</div>
|
||||||
|
<h4 class="Subsection">Value</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.Sweeped:Value">
|
||||||
|
<tt>true</tt> if the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a> cleans up the inactive <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> objects
|
||||||
|
every 60 seconds; otherwise, <tt>false</tt>.
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.Sweeped:Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="P:WebSocketSharp.Server.WebSocketServiceManager.Sweeped:Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
<h3 id="M:WebSocketSharp.Server.WebSocketServiceManager.TryGetWebSocketService(System.String,WebSocketSharp.Server.WebSocketService@)">TryGetWebSocketService Method</h3>
|
||||||
|
<blockquote id="M:WebSocketSharp.Server.WebSocketServiceManager.TryGetWebSocketService(System.String,WebSocketSharp.Server.WebSocketService@):member">
|
||||||
|
<p class="Summary">
|
||||||
|
Tries to get the <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> associated with the specified <i>id</i>.
|
||||||
|
</p>
|
||||||
|
<h2>Syntax</h2>
|
||||||
|
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a> <b>TryGetWebSocketService</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> id, <i>out</i> <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketService</a> service)</div>
|
||||||
|
<h4 class="Subsection">Parameters</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.TryGetWebSocketService(System.String,WebSocketSharp.Server.WebSocketService@):Parameters">
|
||||||
|
<dl>
|
||||||
|
<dt>
|
||||||
|
<i>id</i>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains the ID to find.
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<i>service</i>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
When this method returns, contains the <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> with the specified <i>id</i>, if the <i>id</i> is found; otherwise, <tt>null</tt>.
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</blockquote>
|
||||||
|
<h4 class="Subsection">Returns</h4>
|
||||||
|
<blockquote class="SubsectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.TryGetWebSocketService(System.String,WebSocketSharp.Server.WebSocketService@):Returns">
|
||||||
|
<tt>true</tt> if the <a href="../WebSocketSharp.Server/WebSocketServiceManager.html">WebSocketSharp.Server.WebSocketServiceManager</a> manages the <a href="../WebSocketSharp.Server/WebSocketService.html">WebSocketSharp.Server.WebSocketService</a> with the specified <i>id</i>; otherwise, <tt>false</tt>.
|
||||||
|
</blockquote>
|
||||||
|
<h2 class="Section">Remarks</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.TryGetWebSocketService(System.String,WebSocketSharp.Server.WebSocketService@):Remarks">
|
||||||
|
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
|
||||||
|
</div>
|
||||||
|
<h2 class="Section">Requirements</h2>
|
||||||
|
<div class="SectionBox" id="M:WebSocketSharp.Server.WebSocketServiceManager.TryGetWebSocketService(System.String,WebSocketSharp.Server.WebSocketService@):Version Information">
|
||||||
|
<b>Namespace: </b>WebSocketSharp.Server<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
|
||||||
|
<hr size="1" />
|
||||||
|
</blockquote>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr size="1" />
|
||||||
|
<div class="Copyright">
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,220 @@
|
|||||||
|
<Type Name="WebSocketServiceManager" FullName="WebSocketSharp.Server.WebSocketServiceManager">
|
||||||
|
<TypeSignature Language="C#" Value="public class WebSocketServiceManager" />
|
||||||
|
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit WebSocketServiceManager extends System.Object" />
|
||||||
|
<AssemblyInfo>
|
||||||
|
<AssemblyName>websocket-sharp</AssemblyName>
|
||||||
|
</AssemblyInfo>
|
||||||
|
<Base>
|
||||||
|
<BaseTypeName>System.Object</BaseTypeName>
|
||||||
|
</Base>
|
||||||
|
<Interfaces />
|
||||||
|
<Docs>
|
||||||
|
<summary>
|
||||||
|
Manages the collection of <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects.
|
||||||
|
</summary>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
<Members>
|
||||||
|
<Member MemberName="ActiveIDs">
|
||||||
|
<MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<string> ActiveIDs { get; }" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<string> ActiveIDs" />
|
||||||
|
<MemberType>Property</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Collections.Generic.IEnumerable<System.String></ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Docs>
|
||||||
|
<summary>
|
||||||
|
Gets the collection of IDs of active <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects
|
||||||
|
managed by the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" />.
|
||||||
|
</summary>
|
||||||
|
<value>
|
||||||
|
An IEnumerable<string> that contains the collection of IDs of active <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects.
|
||||||
|
</value>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="Broadcast">
|
||||||
|
<MemberSignature Language="C#" Value="public void Broadcast (byte[] data);" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Broadcast(unsigned int8[] data) cil managed" />
|
||||||
|
<MemberType>Method</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Void</ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Parameters>
|
||||||
|
<Parameter Name="data" Type="System.Byte[]" />
|
||||||
|
</Parameters>
|
||||||
|
<Docs>
|
||||||
|
<param name="data">
|
||||||
|
An array of <see cref="T:System.Byte" /> to broadcast.
|
||||||
|
</param>
|
||||||
|
<summary>
|
||||||
|
Broadcasts the specified array of <see cref="T:System.Byte" /> to the clients of every <see cref="T:WebSocketSharp.Server.WebSocketService" />
|
||||||
|
managed by the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" />.
|
||||||
|
</summary>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="Broadcast">
|
||||||
|
<MemberSignature Language="C#" Value="public void Broadcast (string data);" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Broadcast(string data) cil managed" />
|
||||||
|
<MemberType>Method</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Void</ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Parameters>
|
||||||
|
<Parameter Name="data" Type="System.String" />
|
||||||
|
</Parameters>
|
||||||
|
<Docs>
|
||||||
|
<param name="data">
|
||||||
|
A <see cref="T:System.String" /> to broadcast.
|
||||||
|
</param>
|
||||||
|
<summary>
|
||||||
|
Broadcasts the specified <see cref="T:System.String" /> to the clients of every <see cref="T:WebSocketSharp.Server.WebSocketService" />
|
||||||
|
managed by the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" />.
|
||||||
|
</summary>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="Broadping">
|
||||||
|
<MemberSignature Language="C#" Value="public System.Collections.Generic.Dictionary<string,bool> Broadping (string message);" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.Dictionary`2<string, bool> Broadping(string message) cil managed" />
|
||||||
|
<MemberType>Method</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Collections.Generic.Dictionary<System.String,System.Boolean></ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Parameters>
|
||||||
|
<Parameter Name="message" Type="System.String" />
|
||||||
|
</Parameters>
|
||||||
|
<Docs>
|
||||||
|
<param name="message">
|
||||||
|
A <see cref="T:System.String" /> that contains a message.
|
||||||
|
</param>
|
||||||
|
<summary>
|
||||||
|
Pings with the specified <see cref="T:System.String" /> to the clients of every <see cref="T:WebSocketSharp.Server.WebSocketService" />
|
||||||
|
managed by the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" />.
|
||||||
|
</summary>
|
||||||
|
<returns>
|
||||||
|
A Dictionary<string, bool> that contains the collection of IDs and values
|
||||||
|
indicating whether each <see cref="T:WebSocketSharp.Server.WebSocketService" /> received a Pong in a time.
|
||||||
|
</returns>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="Count">
|
||||||
|
<MemberSignature Language="C#" Value="public int Count { get; }" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".property instance int32 Count" />
|
||||||
|
<MemberType>Property</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Int32</ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Docs>
|
||||||
|
<summary>
|
||||||
|
Gets the number of <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects
|
||||||
|
managed by the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" />.
|
||||||
|
</summary>
|
||||||
|
<value>
|
||||||
|
An <see cref="T:System.Int32" /> that contains the number of <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects
|
||||||
|
managed by the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" />.
|
||||||
|
</value>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="IDs">
|
||||||
|
<MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<string> IDs { get; }" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<string> IDs" />
|
||||||
|
<MemberType>Property</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Collections.Generic.IEnumerable<System.String></ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Docs>
|
||||||
|
<summary>
|
||||||
|
Gets the collection of IDs of <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects
|
||||||
|
managed by the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" />.
|
||||||
|
</summary>
|
||||||
|
<value>
|
||||||
|
An IEnumerable<string> that contains the collection of IDs of <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects.
|
||||||
|
</value>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="InactiveIDs">
|
||||||
|
<MemberSignature Language="C#" Value="public System.Collections.Generic.IEnumerable<string> InactiveIDs { get; }" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Generic.IEnumerable`1<string> InactiveIDs" />
|
||||||
|
<MemberType>Property</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Collections.Generic.IEnumerable<System.String></ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Docs>
|
||||||
|
<summary>
|
||||||
|
Gets the collection of IDs of inactive <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects
|
||||||
|
managed by the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" />.
|
||||||
|
</summary>
|
||||||
|
<value>
|
||||||
|
An IEnumerable<string> that contains the collection of IDs of inactive <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects.
|
||||||
|
</value>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="Sweep">
|
||||||
|
<MemberSignature Language="C#" Value="public void Sweep ();" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Sweep() cil managed" />
|
||||||
|
<MemberType>Method</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Void</ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Parameters />
|
||||||
|
<Docs>
|
||||||
|
<summary>
|
||||||
|
Cleans up the inactive <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects.
|
||||||
|
</summary>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="Sweeped">
|
||||||
|
<MemberSignature Language="C#" Value="public bool Sweeped { get; }" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".property instance bool Sweeped" />
|
||||||
|
<MemberType>Property</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Boolean</ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Docs>
|
||||||
|
<summary>
|
||||||
|
Gets a value indicating whether the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" /> cleans up
|
||||||
|
the inactive <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects periodically.
|
||||||
|
</summary>
|
||||||
|
<value>
|
||||||
|
<c>true</c> if the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" /> cleans up the inactive <see cref="T:WebSocketSharp.Server.WebSocketService" /> objects
|
||||||
|
every 60 seconds; otherwise, <c>false</c>.
|
||||||
|
</value>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
<Member MemberName="TryGetWebSocketService">
|
||||||
|
<MemberSignature Language="C#" Value="public bool TryGetWebSocketService (string id, out WebSocketSharp.Server.WebSocketService service);" />
|
||||||
|
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool TryGetWebSocketService(string id, class WebSocketSharp.Server.WebSocketService service) cil managed" />
|
||||||
|
<MemberType>Method</MemberType>
|
||||||
|
<ReturnValue>
|
||||||
|
<ReturnType>System.Boolean</ReturnType>
|
||||||
|
</ReturnValue>
|
||||||
|
<Parameters>
|
||||||
|
<Parameter Name="id" Type="System.String" />
|
||||||
|
<Parameter Name="service" Type="WebSocketSharp.Server.WebSocketService&" RefType="out" />
|
||||||
|
</Parameters>
|
||||||
|
<Docs>
|
||||||
|
<param name="id">
|
||||||
|
A <see cref="T:System.String" /> that contains the ID to find.
|
||||||
|
</param>
|
||||||
|
<param name="service">
|
||||||
|
When this method returns, contains the <see cref="T:WebSocketSharp.Server.WebSocketService" /> with the specified <paramref name="id" />, if the <paramref name="id" /> is found; otherwise, <see langword="null" />.
|
||||||
|
</param>
|
||||||
|
<summary>
|
||||||
|
Tries to get the <see cref="T:WebSocketSharp.Server.WebSocketService" /> associated with the specified <paramref name="id" />.
|
||||||
|
</summary>
|
||||||
|
<returns>
|
||||||
|
<c>true</c> if the <see cref="T:WebSocketSharp.Server.WebSocketServiceManager" /> manages the <see cref="T:WebSocketSharp.Server.WebSocketService" /> with the specified <paramref name="id" />; otherwise, <c>false</c>.
|
||||||
|
</returns>
|
||||||
|
<remarks>To be added.</remarks>
|
||||||
|
</Docs>
|
||||||
|
</Member>
|
||||||
|
</Members>
|
||||||
|
</Type>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<Namespace Name="WebSocketSharp.Net.WebSockets">
|
<Namespace Name="WebSocketSharp.Net.WebSockets">
|
||||||
<Docs>
|
<Docs>
|
||||||
<summary>To be added.</summary>
|
<summary>To be added.</summary>
|
||||||
<remarks>The WebSocketSharp.Net.WebSockets namespace provides access to the WebSocket connection request objects sent from the client to the server.</remarks>
|
<remarks>The WebSocketSharp.Net.WebSockets namespace contains classes to access to the WebSocket connection request objects.</remarks>
|
||||||
</Docs>
|
</Docs>
|
||||||
</Namespace>
|
</Namespace>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<Namespace Name="WebSocketSharp.Net">
|
<Namespace Name="WebSocketSharp.Net">
|
||||||
<Docs>
|
<Docs>
|
||||||
<summary>To be added.</summary>
|
<summary>To be added.</summary>
|
||||||
<remarks>The WebSocketSharp.Net namespace provides some modified classes in the System.Net namespace (e.g. <see cref="T:System.Net.HttpListenerContext"/>) to accept the WebSocket connection request.</remarks>
|
<remarks>The WebSocketSharp.Net namespace contains some modified classes and enumerations in the System.Net namespace (e.g. <see cref="T:System.Net.HttpListenerContext"/>) to accept the WebSocket connection requests.</remarks>
|
||||||
</Docs>
|
</Docs>
|
||||||
</Namespace>
|
</Namespace>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<Namespace Name="WebSocketSharp.Server">
|
<Namespace Name="WebSocketSharp.Server">
|
||||||
<Docs>
|
<Docs>
|
||||||
<summary>To be added.</summary>
|
<summary>To be added.</summary>
|
||||||
<remarks>The WebSocketSharp.Server namespace provides the functions of the server that receives the WebSocket connection requests.</remarks>
|
<remarks>The WebSocketSharp.Server namespace contains classes to implement the server that receives the WebSocket connection requests.</remarks>
|
||||||
</Docs>
|
</Docs>
|
||||||
</Namespace>
|
</Namespace>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<Namespace Name="WebSocketSharp">
|
<Namespace Name="WebSocketSharp">
|
||||||
<Docs>
|
<Docs>
|
||||||
<summary>To be added.</summary>
|
<summary>To be added.</summary>
|
||||||
<remarks>The WebSocketSharp namespace provides an implementation of the WebSocket interface.</remarks>
|
<remarks>The WebSocketSharp namespace contains classes and enumerations to implement the WebSocket interface.</remarks>
|
||||||
</Docs>
|
</Docs>
|
||||||
</Namespace>
|
</Namespace>
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue