Skip to main content

WebSocketRemoteConsole

A class in Root.Township, Alta.Console.

The server's websocket remote console: a Fleck server on port 1760 that makes a WebSocketCommandHandler per connection.

Constructors​

MemberWhat it is
WebSocketRemoteConsole()Creates a WebSocketRemoteConsole with default values.

Fields​

MemberWhat it is
static List<WebSocketCommandHandler> HandlersCommand handlers for the open websocket connections.
const int WebsocketPortThe websocket console port, 1760.
2 private and internal fields
MemberWhat it is
private static Logger loggerNLog logger for this class.
private WebSocketServer serverThe Fleck websocket server.

Properties​

MemberWhat it is
static bool IsActive { get; private set; }True while the websocket server is started.

Events​

MemberWhat it is
event Action<UserInfoWithPermissions, IRemoteConsoleHandler> ConsoleConnectedRaised when a connection's handler is authorized, with its user.
event Action<UserInfoWithPermissions, IRemoteConsoleHandler> ConsoleDisconnectedRaised when an authorized connection closes.

Methods​

MemberWhat it is
void Close()Disposes the websocket server and marks it inactive.
void Start()Starts listening on ws://0.0.0.0:1760, routing Fleck logs into NLog; on failure logs and stays inactive.
3 private and internal methods
MemberWhat it is
private void CreateNewCommandHandler(IWebSocketConnection socket)Makes and tracks a command handler for a new socket and hooks its closed and authorized events.
private void HandlerAuthorized(WebSocketCommandHandler handler)Raises ConsoleConnected once a handler is authorized.
private void RemoteConsoleClosed(WebSocketCommandHandler handler)Drops a closed handler from Handlers and raises ConsoleDisconnected if it was authorized.