awv3-node
node.js classcad instance manager
Last updated 6 months ago by phipsy7 .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install awv3-node 
SYNC missed versions from official npm registry.

ClassCAD instance manager based on Node.js

This is a Node.js implementation using Socket.IO as the communications protocol.

Install

npm install awv3-node

Instance server

The instance manager represents a single endpoint where users connect in order to work with ClassCAD sessions. It may ship ClassCAD binaries and boot them up when starting, but it can also rely on seperate 'farms', servers that host ClassCAD processes.

const path = require('path')
const Server = require('awv3-node/server').default
const Logger = require('awv3-node/extras/logger').default

const server = new Server(
  {
    instances: 1,
    // The following are all defaults ...
    executable: 'ClassCADInstance.exe',
    configurationData: 'CADApplication.ini',
    output: path.resolve('./node_modules/@awv/classcad_cadapplication'),
    protocol: 'http',
    serverOptions: {},
    ip: 'localhost',
    privatePort: 0,
    publicPort: 8181,
    binary: true,
    multipart: true,
    compression: true,
    sendTreePatches: true,
    stdout: false,
    secureApi: false,
    debug: true,
    showConsole: false,
    stateDebounce: 500,
    workerTimeout: 1000 * 15,
    restTimeout: 1000 * 60 * 2,
    collectResultsOnly: true,
    logExpirationDays: 5,
  },
  Logger({ spinOnFirstUser: true }),
).start()

REST API

Log in a new user with the /login endpoint. The user will be treated in the same way as a socket.IO user. This has been abstracted in the awv3 library under the /communication/rest class which features the same API as the socketio or the signalr classes.

GET /login/:id

    response => { op: 'system', status: [either 'permitted' or 'rejected'], id: [session ID] }

Log out with the /logout endpoint

GET /logout/:id

    response => "disconnected"

Execute tasks with the /execute endpoint. Note that due to the limitations of REST, there is no server push available. Results will be sent in a single, complete chunk. Another limitation is that requests may time out, should the server be too busy. Such errors need to be handled by the client.

POST /execute/:id
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
    },
    method: "POST",
    body: JSON.stringify(command)

    response => Array of results

Custom load balancing

Override the [server.health] function to determine the instances health status. The function must return a HTTP status code. Load balancers can probe the /health endpoint to flag single instances as busy, which will remove them from the set of balanced instances until they become active again. The default criteria seeks to flag an instance as not-healthy (status code 503, service unavailable) if 90% of its ClassCAD sessions are busy.

server.health = function() {
  let sessions = Array.from(server.sessions.values())
  let busy = 0
  for (let session of sessions) if (session.tasks.size > 0) busy++

  // If 90% are busy, start flagging the instance as unhealthy
  return busy > sessions.length * 0.9 ? 503 : 200
}

Current Tags

  • 9.0.1                                ...           beta (a year ago)
  • 9.0.3                                ...           latest (6 months ago)

137 Versions

  • 9.0.3                                ...           6 months ago
  • 9.0.2                                ...           a year ago
  • 9.0.1                                ...           a year ago
  • 9.0.0                                ...           a year ago
  • 8.2.33                                ...           a year ago
  • 8.2.32                                ...           a year ago
  • 8.2.31                                ...           a year ago
  • 8.2.30                                ...           a year ago
  • 8.2.28                                ...           a year ago
  • 8.2.27                                ...           a year ago
  • 8.2.26                                ...           a year ago
  • 8.2.25                                ...           a year ago
  • 8.2.24                                ...           a year ago
  • 8.2.23                                ...           a year ago
  • 8.2.22                                ...           a year ago
  • 8.2.21                                ...           a year ago
  • 8.2.20                                ...           a year ago
  • 8.2.19                                ...           a year ago
  • 8.2.18                                ...           a year ago
  • 8.2.17                                ...           a year ago
  • 8.2.16                                ...           a year ago
  • 8.2.15                                ...           a year ago
  • 8.2.14                                ...           2 years ago
  • 8.2.13                                ...           2 years ago
  • 8.2.12                                ...           2 years ago
  • 8.2.11                                ...           2 years ago
  • 8.2.10                                ...           2 years ago
  • 8.2.9                                ...           2 years ago
  • 8.2.8                                ...           2 years ago
  • 8.2.7                                ...           2 years ago
  • 7.4.2                                ...           2 years ago
  • 8.2.6                                ...           2 years ago
  • 8.2.0 [deprecated]           ...           2 years ago
  • 8.1.3                                ...           2 years ago
  • 8.1.2                                ...           2 years ago
  • 8.1.1                                ...           2 years ago
  • 8.1.0                                ...           2 years ago
  • 8.0.3                                ...           2 years ago
  • 8.0.2                                ...           2 years ago
  • 8.0.1                                ...           2 years ago
  • 8.0.0                                ...           2 years ago
  • 7.4.1                                ...           2 years ago
  • 7.4.0                                ...           2 years ago
  • 7.3.2-beta.2                                ...           2 years ago
  • 7.3.2-beta.1                                ...           2 years ago
  • 7.3.2                                ...           2 years ago
  • 7.3.1                                ...           2 years ago
  • 7.3.0                                ...           2 years ago
  • 7.2.0                                ...           2 years ago
  • 7.1.20                                ...           2 years ago
  • 7.1.19                                ...           2 years ago
  • 7.1.18                                ...           2 years ago
  • 7.1.17                                ...           2 years ago
  • 7.1.16-beta1                                ...           2 years ago
  • 7.1.16                                ...           2 years ago
  • 7.1.15                                ...           2 years ago
  • 7.1.14                                ...           2 years ago
  • 7.1.13                                ...           2 years ago
  • 7.1.12                                ...           2 years ago
  • 7.1.11                                ...           2 years ago
  • 7.1.10                                ...           2 years ago
  • 7.1.9                                ...           2 years ago
  • 7.1.8                                ...           2 years ago
  • 7.1.7                                ...           2 years ago
  • 7.1.6                                ...           2 years ago
  • 7.1.5                                ...           2 years ago
  • 7.1.4                                ...           2 years ago
  • 7.1.3                                ...           2 years ago
  • 7.1.2                                ...           2 years ago
  • 7.1.1                                ...           2 years ago
  • 7.1.0                                ...           2 years ago
  • 7.0.5                                ...           2 years ago
  • 7.0.4                                ...           2 years ago
  • 7.0.2                                ...           2 years ago
  • 7.0.1                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 1.0.64                                ...           3 years ago
  • 1.0.63                                ...           3 years ago
  • 1.0.62                                ...           3 years ago
  • 1.0.61                                ...           3 years ago
  • 1.0.60                                ...           3 years ago
  • 1.0.59                                ...           3 years ago
  • 1.0.58                                ...           3 years ago
  • 1.0.57                                ...           3 years ago
  • 1.0.56                                ...           3 years ago
  • 1.0.55                                ...           3 years ago
  • 1.0.54                                ...           3 years ago
  • 1.0.53                                ...           3 years ago
  • 1.0.52                                ...           3 years ago
  • 1.0.51                                ...           3 years ago
  • 1.0.50                                ...           3 years ago
  • 1.0.49                                ...           3 years ago
  • 1.0.48                                ...           3 years ago
  • 1.0.46                                ...           3 years ago
  • 1.0.45                                ...           3 years ago
  • 1.0.44                                ...           3 years ago
  • 1.0.43                                ...           3 years ago
  • 1.0.42                                ...           3 years ago
  • 1.0.41                                ...           3 years ago
  • 1.0.40                                ...           3 years ago
  • 1.0.39                                ...           3 years ago
  • 1.0.37                                ...           3 years ago
  • 1.0.36                                ...           3 years ago
  • 1.0.35                                ...           3 years ago
  • 1.0.34                                ...           3 years ago
  • 1.0.33                                ...           3 years ago
  • 1.0.32                                ...           3 years ago
  • 1.0.31                                ...           3 years ago
  • 1.0.30                                ...           3 years ago
  • 1.0.29                                ...           3 years ago
  • 1.0.27                                ...           3 years ago
  • 1.0.26                                ...           3 years ago
  • 1.0.25                                ...           3 years ago
  • 1.0.24                                ...           3 years ago
  • 1.0.23                                ...           3 years ago
  • 1.0.22                                ...           3 years ago
  • 1.0.21                                ...           3 years ago
  • 1.0.20                                ...           3 years ago
  • 1.0.19                                ...           3 years ago
  • 1.0.18                                ...           3 years ago
  • 1.0.17                                ...           3 years ago
  • 1.0.16                                ...           3 years ago
  • 1.0.15                                ...           3 years ago
  • 1.0.13                                ...           3 years ago
  • 1.0.12                                ...           3 years ago
  • 1.0.11                                ...           3 years ago
  • 1.0.10                                ...           3 years ago
  • 1.0.9                                ...           3 years ago
  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (28)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |