2.1.0 • Published 7 months ago

@ekhein/sekiro-node-client v2.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

Sekiro Node.js Client

A Node.js client for the Sekiro WebSocket API.

Installation

npm install sekiro-node-client

Usage

import SekiroClient from 'sekiro-node-client';

// Create client instance
const client = new SekiroClient('ws://your-sekiro-server:port', {
  reconnectInterval: 2000,
  maxReconnectAttempts: 10
});

// Register action handlers
client.registerAction('test', (request, success, failure) => {
  try {
    // Process request
    success({ result: 'ok', data: request });
  } catch (error) {
    failure(error.message);
  }
});

// Graceful shutdown
process.on('SIGINT', () => {
  client.close();
  process.exit();
});

API

new SekiroClient(wsURL, [options])

Creates a new SekiroClient instance.

Parameters:

  • wsURL: WebSocket server URL (required)
  • options: Configuration options (optional)
    • reconnectInterval: Base reconnect interval in ms (default: 2000)
    • maxReconnectAttempts: Maximum reconnect attempts (default: 10)
    • wsOptions: Additional WebSocket options

Methods:

  • registerAction(action, handler): Register a handler for an action
  • close(): Close the WebSocket connection

License

MIT

2.1.0

7 months ago

2.0.4

7 months ago

2.0.3

8 months ago

2.0.2

8 months ago

2.0.1

8 months ago

2.0.0

8 months ago

1.0.8

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago