2.1.0 • Published 10 months ago

@ekhein/sekiro-node-client v2.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
10 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

10 months ago

2.0.4

10 months ago

2.0.3

10 months ago

2.0.2

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.0.8

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago