Type of the header containing initial data.
Type of additional features provided for the remote client.
Default Constructor.
Create a web-socket server, without secured option (ws://
).
Initializer Constructor.
Create a secured web-socket server with key and certification data (wss://
).
Key string.
Certification string.
Current state of the MutexServer
Get server state.
Get current state of the mutex-server
. List of values are such like below:
NONE
: The `MutexServer instance is newly created, but did nothing yet.OPENING
: The MutexServer.open method is on running.OPEN
: The mutex-server
is online.CLOSING
: The MutexServer.close method is on running.CLOSED
: The mutex-server
is offline.Close the mutex-server
.
Close the mutex-server
and disconnect all the remote connections between its clients.
Therefore, clients who are using the MutexConnector class, they can't use the
remote-thread-components more.
Also, closing the server means that all of the RFCs between the server and had connected clients would be destroied. Therefore, all of the RFCs that are not returned (completed) yet would ge RuntimeError exception.
Open a mutex-server
.
Open a mutex-server
through web-socket protocol, with its port number and predicator
function determining whether to accept the client's connection or not. After the
mutex-server
has been opened, clients can connect to that mutex-server
by using the
MutexConnector class.
When implementing the predicator function, returns true
if you want to accept a new
client's connection. Otherwise you dont't want to accept the client and reject its
connection, returns false
instead.
Note that, this mutex-server
handles the global critical sections on the entire network
level. If you define the predicator function to accept every client's connection, some
bad guy can spoil your own mutex-server
by monopolying those critical sections.
Therefore, don't implement the predicator function to returns only true
, but filter
clients' connections by considering their MutexAcceptor.header data.
Port number to listen.
A handler function determining whether to accept the client's connection or not.
Generated using TypeDoc
The Mutex Server.
The MutexServer is a class who can open an
mutex-server
. Clients connecting to themutex-server
would communicate with this server through MutexAcceptor objects using websocket and RFC protocol.To open the
mutex-server
, call the open method with your custom callback function which would be called whenever a MutexAcceptor has been newly created by a client's connection.Also, when declaring this MutexServer type, you've to define two template arguments, Header and Provider*. The *Header type repersents an initial data gotten from the remote client after the connection. I hope you and client not to omit it and utilize it as an activation tool to enhance security.
The second template argument Provider represents the additional features provided for the remote client. If you don't have any plan to provide additional feature to the remote client, just declare it as
null
.Jeongho Nam - https://github.com/samchon