1.0.0 • Published 5 months ago
@xclouder/remote-console-core v1.0.0
@remote-console/core
Remote Console Core Framework - A flexible remote console solution for various platforms.
Installation
npm install @remote-console/core
Features
- Cross-platform remote console functionality
- Flexible connection interfaces
- TypeScript support
- Customizable logging
- Auto-reconnection support
- Platform-agnostic design
Usage
import { RemoteConsoleClient } from '@remote-console/core';
import { NodeSocketConnection, NodeLogger } from '@remote-console/node';
// Create a client instance
const client = new RemoteConsoleClient({
serverUrl: 'http://localhost:3000',
platform: 'desktop',
deviceName: 'My Device',
debug: true,
autoReconnect: true,
reconnectDelay: 3000,
maxReconnectAttempts: -1
}, new NodeSocketConnection('http://localhost:3000'), new NodeLogger(true));
// Handle commands
client.setCommandHandler(async (command) => {
switch (command) {
case 'hello':
return 'Hello from remote console!';
default:
return `Unknown command: ${command}`;
}
});
API Documentation
RemoteConsoleClient
The main class for creating a remote console client.
Constructor
constructor(
config: ClientConfig,
connection: IConnection,
logger: ILogger
)
Configuration Options
serverUrl
: Server URL to connect toplatform
: Platform type ('desktop', 'mobile', 'web', 'unity', 'unreal')deviceName
: Name of the devicedebug
: Enable debug loggingautoReconnect
: Enable automatic reconnectionreconnectDelay
: Delay between reconnection attempts (ms)maxReconnectAttempts
: Maximum number of reconnection attempts (-1 for infinite)
License
MIT
1.0.0
5 months ago