• MARS Website
  • Core API
  • SmartOpenHamburg API
  • Model Components API
  • Common API
Show / Hide Table of Contents
  • Mars.Common
    • GeoHash
    • GeoHashDecoder
    • GeohashDecodeResult
    • GeoHashEncoder
    • GeoHashPrecision
    • Hyperrectangle
    • InputHashHelper
    • PositionHelper
  • Mars.Common.Collections
    • BinaryArrayHeap<T>
    • DoubleBits
    • FibonacciHeap<T, TKey>
    • FibonacciHeapDoubleKey<T>
    • FibonacciHeapNode<T, TKey>
    • FibonacciHeapNodeDoubleKey<T>
    • HeapNode
    • IntervalSize
    • K2DTree<T>
    • K2dTreeNode<T>
    • KdTree
    • KdTree<T>
    • KdTreeBase<TNode>
    • KdTreeNode
    • KdTreeNode<T>
    • KdTreeNodeBase<TNode>
    • KdTreeNodeCollection<TNode>
    • KdTreeNodeList<T>
    • Key
    • Node<T>
    • NodeBase<T>
    • NodeDataContainer<T>
    • NodeDistance<TNode>
    • QuadTree<T>
    • Root<T>
    • TreeDataContainer<T>
  • Mars.Common.Collections.CritBit
    • ICritBitTree<TValue>
  • Mars.Common.Collections.Graph
    • EdgeData
    • GraphData
    • GraphSerializer
    • ISpatialGraph
    • KeyContainer
    • NodeData
    • SpatialGraph
    • SpatialGraphHelper
  • Mars.Common.Collections.Graph.Algorithms
    • AStar
    • CompressedPathDatabase
    • ContractionSearch
    • DepthLimitedTraversal
  • Mars.Common.Collections.Graph.Helper
    • INodeFinder
    • KdTreeNodeFinder
    • RunLengthEncoder
  • Mars.Common.Collections.KNNGraph
    • DefaultRandomGenerator
    • DistanceUtils
    • EventSources
    • EventSources.GraphBuildEventSource
    • EventSources.GraphSearchEventSource
    • IProgressReporter
    • IProvideRandomValues
    • KnnGraph<TItem, TDistance>
    • KnnGraph<TItem, TDistance>.KnnSearchResult
    • KnnGraph<TItem, TDistance>.Parameters
    • Node
    • ReverseComparer<T>
    • ReverseComparerExtensions
    • SelectionKind
    • TravelingCosts<TItem, TDistance>
  • Mars.Common.Compat
    • FormatDecoderAttribute
    • FormatEncoderAttribute
    • FormatHandlerAttribute
    • IntegerAttribute
    • NegativeIntegerAttribute
    • NonnegativeIntegerAttribute
    • NonpositiveIntegerAttribute
    • PositiveIntegerAttribute
  • Mars.Common.Data
    • DomainDataImporter
  • Mars.Common.Data.Providers
    • AscDataProvider
    • GeoJsonFeatureCollectionConverter
    • GeoJsonFeatureConverter
    • GeoJsonHelper
    • GeometryDataProvider
    • GraphMlProvider
    • HttpDataProvider
    • IDataProvider<TInput>
    • JsonFileDataProvider
    • JsonTextDataProvider
    • XmlFileDataProvider
    • XmlTextDataProvider
  • Mars.Common.Exceptions
    • DimensionMismatchException
    • ParseException
  • Mars.Common.IO
    • ExtensionMethods
    • FileClientUtils
    • FileKeys
    • HttpClientUtils
    • ObjectSerialize
    • Serializer
    • SerializerCompression
    • SparseFormat
    • SparseReader
    • SparseWriter
  • Mars.Common.IO.Attributes
    • SerializationBinderAttribute
    • SurrogateSelectorAttribute
  • Mars.Common.IO.Console
    • ChildProgressBar
    • IProgressBar
    • ProgressBar
    • ProgressBarBase
    • ProgressBarHeight
    • ProgressBarOptions
    • ProgressBarSimple
  • Mars.Common.IO.Csv
    • CsvAnalyzer
    • CsvReader
    • CsvReader.RecordEnumerator
    • CsvWriter
    • MissingFieldAction
    • ParseErrorAction
    • ValueTrimmingOptions
  • Mars.Common.IO.Events
    • ParseErrorEventArgs
  • Mars.Common.IO.Exceptions
    • MalformedCsvException
    • MissingFieldCsvException
  • Mars.Common.IO.Mapped
    • Context
    • DefaultArrayFactory
    • Extensions
    • IArrayFactory
    • ISerializableToStream
    • MappedAccessor<T>
    • MemoryMap
    • MemoryMap.CreateAccessorFunc<T>
    • MemoryMap.ReadFromDelegate<T>
    • MemoryMap.WriteToDelegate<T>
    • MemoryMapDelegates
    • MemoryMapDelegates.CreateAccessorFunc<T>
    • MemoryMapStream
  • Mars.Common.IO.Mapped.Accessors
    • MappedAccessorByte
    • MappedAccessorDouble
    • MappedAccessorInt16
    • MappedAccessorInt32
    • MappedAccessorInt64
    • MappedAccessorSingle
    • MappedAccessorUInt16
    • MappedAccessorUInt32
    • MappedAccessorUInt64
    • MappedAccessorVariable<T>
  • Mars.Common.IO.Mapped.Arrays
    • Array<T>
    • ArrayBase<T>
    • ArrayProfile
    • MappedArray<TMapped, T>
    • MappedArray<TMapped, T>.MapFrom
    • MappedArray<TMapped, T>.MapTo
    • MemoryArray<T>
    • VariableArray<T>
  • Mars.Common.IO.Mapped.Collections
    • MemoryBackedDictionary<TKey, TValue>
    • MemoryBackedList<T>
  • Mars.Common.IO.Mapped.Indexes
    • Index<T>
  • Mars.Common.IO.Mapped.Streams
    • CappedStream
  • Mars.Common.Socket
    • ByteOrder
    • CloseEventArgs
    • CloseStatusCode
    • CompressionMethod
    • ErrorEventArgs
    • Ext
    • MessageEventArgs
    • WebSocket
    • WebSocketException
    • WebSocketState
  • Mars.Common.Socket.Server
    • IWebSocketSession
    • WebHeaderCollection
    • WebSocketBehavior
    • WebSocketContext
    • WebSocketServer
    • WebSocketServiceHost
    • WebSocketServiceManager
    • WebSocketSessionManager
  • Mars.Numerics
    • Classes
    • Combinatorics
    • Constants
    • Distance
    • Elementwise
    • Jagged
    • MathematicsException
    • MathHelper
    • Matrix
    • MatrixOrder
    • MatrixType
    • Norm
    • Sort
    • Sorting
    • Sparse
    • Sparse<T>
    • Tools
    • Vector
    • VectorHelper
    • VectorType
  • Mars.Numerics.Comparers
    • ArrayComparer<T>
    • ComparerDirection
    • CustomComparer<T>
    • ElementComparer
    • ElementComparer<T>
    • GeneralComparer
    • StableComparer<T>
  • Mars.Numerics.Distances
    • Angular
    • Chebyshev
    • Cosine
    • Dirac<T>
    • Euclidean
    • Hamming
    • Hamming<T>
    • Haversine
    • Jaccard
    • Jaccard<T>
    • Kulczynski
    • Levenshtein
    • Levenshtein<T>
    • Manhattan
    • Matching
    • Minkowski
    • SquareEuclidean
    • Vincenty
    • Vincenty.Ellipsoid
  • Mars.Numerics.Distances.Base
    • IDistance<T>
    • IDistance<TFirst, TSecond>
    • IMetric<T>
    • ISimilarity<T, TU>
    • ISimilarity<T>
  • Mars.Numerics.Exceptions
    • DimensionMismatchException
    • NonPositiveDefiniteMatrixException
    • SingularMatrixException
  • Mars.Numerics.Formats
    • DefaultMatrixFormatProvider
    • IMatrixFormatProvider
    • MatrixFormatProviderBase
    • MatrixFormatter
    • OctaveMatrixFormatProvider
  • Mars.Numerics.Ranges
    • ByteRange
    • DoubleRange
    • FloatRange
    • IntRange
    • IRange<T>
  • Mars.Numerics.Statistics
    • ConstValueDistribution<T>
    • Distribution<T>
    • FastGaussianDistributionD
    • FastGaussianDistributionF
    • IDistribution
    • UniformDiscreteDistribution
    • UniformDistributionD
    • UniformDistributionF
  • Mars.Numerics.Statistics.Base
    • BinarySearch
    • DistributionBase
    • ISampleableDistribution<TObservations>
    • IUnivariateDistribution
    • IUnivariateDistribution<TObservation>
    • UnivariateDiscreteDistribution

Class WebSocketServiceManager

Provides the management function for the WebSocket services.
Inheritance
System.Object
WebSocketServiceManager
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Common.Socket.Server
Assembly: Mars.Common.dll
Syntax
public class WebSocketServiceManager
Remarks
This class manages the WebSocket services provided by the WebSocketServer or .

Properties

| Improve this Doc View Source

Count

Gets the number of the WebSocket services.
Declaration
public int Count { get; }
Property Value
Type Description
System.Int32 An System.Int32 that represents the number of the services.
Remarks
This class manages the WebSocket services provided by the WebSocketServer or .
| Improve this Doc View Source

Hosts

Gets the host instances for the WebSocket services.
Declaration
public IEnumerable<WebSocketServiceHost> Hosts { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<WebSocketServiceHost>

An IEnumerable<WebSocketServiceHost> instance.

It provides an enumerator which supports the iteration over the collection of the host instances.

Remarks
This class manages the WebSocket services provided by the WebSocketServer or .
| Improve this Doc View Source

Item[String]

Gets the host instance for a WebSocket service with the specified path.
Declaration
public WebSocketServiceHost this[string path] { get; }
Parameters
Type Name Description
System.String path A System.String that represents an absolute path to the service to find.
Property Value
Type Description
WebSocketServiceHost

A WebSocketServiceHost instance or null if not found.

That host instance provides the function to access the information in the service.

Remarks
path is converted to a URL-decoded string and / is trimmed from the end of the converted string if any.
Exceptions
Type Condition
System.ArgumentNullException path is null.
System.ArgumentException

path is empty.

-or-

path is not an absolute path.

-or-

path includes either or both query and fragment components.

| Improve this Doc View Source

KeepClean

Gets or sets a value indicating whether the inactive sessions in the WebSocket services are cleaned up periodically.
Declaration
public bool KeepClean { get; set; }
Property Value
Type Description
System.Boolean true if the inactive sessions are cleaned up every 60 seconds; otherwise, false.
Remarks
The set operation does nothing if the server has already started or it is shutting down.
| Improve this Doc View Source

Paths

Gets the paths for the WebSocket services.
Declaration
public IEnumerable<string> Paths { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.String>

An IEnumerable<string> instance.

It provides an enumerator which supports the iteration over the collection of the paths.

Remarks
This class manages the WebSocket services provided by the WebSocketServer or .
| Improve this Doc View Source

SessionCount

Gets the total number of the sessions in the WebSocket services.
Declaration
[Obsolete("This property will be removed.")]
public int SessionCount { get; }
Property Value
Type Description
System.Int32 An System.Int32 that represents the total number of the sessions in the services.
Remarks
This class manages the WebSocket services provided by the WebSocketServer or .
| Improve this Doc View Source

WaitTime

Gets or sets the time to wait for the response to the WebSocket Ping or Close.
Declaration
public TimeSpan WaitTime { get; set; }
Property Value
Type Description
System.TimeSpan A System.TimeSpan to wait for the response.
Remarks
The set operation does nothing if the server has already started or it is shutting down.
Exceptions
Type Condition
System.ArgumentOutOfRangeException The value specified for a set operation is zero or less.

Methods

| Improve this Doc View Source

AddService<TBehavior>(String, Action<TBehavior>)

Adds a WebSocket service with the specified behavior, path, and initializer.
Declaration
public void AddService<TBehavior>(string path, Action<TBehavior> initializer)
    where TBehavior : WebSocketBehavior, new()
Parameters
Type Name Description
System.String path A System.String that represents an absolute path to the service to add.
System.Action<TBehavior> initializer

An Action<TBehavior> delegate or null if not needed.

That delegate invokes the method called for initializing a new session instance for the service.

Type Parameters
Name Description
TBehavior The type of the behavior for the service. It must inherit the WebSocketBehavior class and it must have a public parameterless constructor.
Remarks
path is converted to a URL-decoded string and / is trimmed from the end of the converted string if any.
Exceptions
Type Condition
System.ArgumentNullException path is null.
System.ArgumentException

path is empty.

-or-

path is not an absolute path.

-or-

path includes either or both query and fragment components.

-or-

path is already in use.

| Improve this Doc View Source

Broadcast(Byte[])

Sends data to every client in the WebSocket services.
Declaration
[Obsolete("This method will be removed.")]
public void Broadcast(byte[] data)
Parameters
Type Name Description
System.Byte[] data An array of System.Byte that represents the binary data to send.
Remarks
This class manages the WebSocket services provided by the WebSocketServer or .
Exceptions
Type Condition
System.InvalidOperationException The current state of the manager is not Start.
System.ArgumentNullException data is null.
| Improve this Doc View Source

Broadcast(String)

Sends data to every client in the WebSocket services.
Declaration
[Obsolete("This method will be removed.")]
public void Broadcast(string data)
Parameters
Type Name Description
System.String data A System.String that represents the text data to send.
Remarks
This class manages the WebSocket services provided by the WebSocketServer or .
Exceptions
Type Condition
System.InvalidOperationException The current state of the manager is not Start.
System.ArgumentNullException data is null.
System.ArgumentException data could not be UTF-8-encoded.
| Improve this Doc View Source

BroadcastAsync(Byte[], Action)

Sends data asynchronously to every client in the WebSocket services.
Declaration
[Obsolete("This method will be removed.")]
public void BroadcastAsync(byte[] data, Action completed)
Parameters
Type Name Description
System.Byte[] data An array of System.Byte that represents the binary data to send.
System.Action completed

An System.Action delegate or null if not needed.

The delegate invokes the method called when the send is complete.

Remarks
This method does not wait for the send to be complete.
Exceptions
Type Condition
System.InvalidOperationException The current state of the manager is not Start.
System.ArgumentNullException data is null.
| Improve this Doc View Source

BroadcastAsync(Stream, Int32, Action)

Sends the data from stream asynchronously to every client in the WebSocket services.
Declaration
[Obsolete("This method will be removed.")]
public void BroadcastAsync(Stream stream, int length, Action completed)
Parameters
Type Name Description
System.IO.Stream stream A System.IO.Stream instance from which to read the data to send.
System.Int32 length An System.Int32 that specifies the number of bytes to send.
System.Action completed

An System.Action delegate or null if not needed.

The delegate invokes the method called when the send is complete.

Remarks

The data is sent as the binary data.

This method does not wait for the send to be complete.

Exceptions
Type Condition
System.InvalidOperationException The current state of the manager is not Start.
System.ArgumentNullException stream is null.
System.ArgumentException

stream cannot be read.

-or-

length is less than 1.

-or-

No data could be read from stream.

| Improve this Doc View Source

BroadcastAsync(String, Action)

Sends data asynchronously to every client in the WebSocket services.
Declaration
[Obsolete("This method will be removed.")]
public void BroadcastAsync(string data, Action completed)
Parameters
Type Name Description
System.String data A System.String that represents the text data to send.
System.Action completed

An System.Action delegate or null if not needed.

The delegate invokes the method called when the send is complete.

Remarks
This method does not wait for the send to be complete.
Exceptions
Type Condition
System.InvalidOperationException The current state of the manager is not Start.
System.ArgumentNullException data is null.
System.ArgumentException data could not be UTF-8-encoded.
| Improve this Doc View Source

Broadping()

Sends a ping to every client in the WebSocket services.
Declaration
[Obsolete("This method will be removed.")]
public Dictionary<string, Dictionary<string, bool>> Broadping()
Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.Dictionary<System.String, System.Boolean>>

A Dictionary<string, Dictionary<string, bool>>.

It represents a collection of pairs of a service path and another collection of pairs of a session ID and a value indicating whether a pong has been received from the client within a time.

Remarks
This class manages the WebSocket services provided by the WebSocketServer or .
Exceptions
Type Condition
System.InvalidOperationException The current state of the manager is not Start.
| Improve this Doc View Source

Broadping(String)

Sends a ping with message to every client in the WebSocket services.
Declaration
[Obsolete("This method will be removed.")]
public Dictionary<string, Dictionary<string, bool>> Broadping(string message)
Parameters
Type Name Description
System.String message

A System.String that represents the message to send.

The size must be 125 bytes or less in UTF-8.

Returns
Type Description
System.Collections.Generic.Dictionary<System.String, System.Collections.Generic.Dictionary<System.String, System.Boolean>>

A Dictionary<string, Dictionary<string, bool>>.

It represents a collection of pairs of a service path and another collection of pairs of a session ID and a value indicating whether a pong has been received from the client within a time.

Remarks
This class manages the WebSocket services provided by the WebSocketServer or .
Exceptions
Type Condition
System.InvalidOperationException The current state of the manager is not Start.
System.ArgumentException message could not be UTF-8-encoded.
System.ArgumentOutOfRangeException The size of message is greater than 125 bytes.
| Improve this Doc View Source

Clear()

Removes all WebSocket services managed by the manager.
Declaration
public void Clear()
Remarks
A service is stopped with close status 1001 (going away) if it has already started.
| Improve this Doc View Source

RemoveService(String)

Removes a WebSocket service with the specified path.
Declaration
public bool RemoveService(string path)
Parameters
Type Name Description
System.String path A System.String that represents an absolute path to the service to remove.
Returns
Type Description
System.Boolean true if the service is successfully found and removed; otherwise, false.
Remarks

path is converted to a URL-decoded string and / is trimmed from the end of the converted string if any.

The service is stopped with close status 1001 (going away) if it has already started.

Exceptions
Type Condition
System.ArgumentNullException path is null.
System.ArgumentException

path is empty.

-or-

path is not an absolute path.

-or-

path includes either or both query and fragment components.

| Improve this Doc View Source

TryGetServiceHost(String, out WebSocketServiceHost)

Tries to get the host instance for a WebSocket service with the specified path.
Declaration
public bool TryGetServiceHost(string path, out WebSocketServiceHost host)
Parameters
Type Name Description
System.String path A System.String that represents an absolute path to the service to find.
WebSocketServiceHost host

When this method returns, a WebSocketServiceHost instance or null if not found.

That host instance provides the function to access the information in the service.

Returns
Type Description
System.Boolean true if the service is successfully found; otherwise, false.
Remarks
path is converted to a URL-decoded string and / is trimmed from the end of the converted string if any.
Exceptions
Type Condition
System.ArgumentNullException path is null.
System.ArgumentException

path is empty.

-or-

path is not an absolute path.

-or-

path includes either or both query and fragment components.

Extension Methods

Serializer.Save<T>(T, out Byte[], SerializerCompression)
Serializer.Save<T>(T, Stream, SerializerCompression)
Serializer.Save<T>(T, BinaryFormatter, Stream, SerializerCompression)
Serializer.Save<T>(T, String, SerializerCompression)
Serializer.Save<T>(T, String)
Matrix.Concatenate<T>(T, T[])
Matrix.Replace<T>(T, Object, Object)
DomainDataImporter.Import(Object, InputConfiguration)
ObjectSerialize.Serialize(Object)
Matrix.IsEqual(Object, Object, Decimal, Decimal)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © MARS GROUP. HAW Hamburg