# docparse-scraper-status-socket

> Setups up an http express app for an single scraper. This app allows external services to get the status of the scraper and start new scrapes

Latest version **1.0.13** (published 2013-05-03) · BSD license · 0 weekly downloads

## Install

```sh
npm install docparse-scraper-status-socket
pnpm add docparse-scraper-status-socket
yarn add docparse-scraper-status-socket
bun add docparse-scraper-status-socket
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.13 |
| Published | 2013-05-03 |
| First published | 2013-03-26 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+6 in 2 direct dependencies) |
| Install scripts | no |
| Author | Noah Isaacson |
| Maintainers | clewfirst |
| Keywords | docparse,  |

## Links

- npm: https://www.npmjs.com/package/docparse-scraper-status-socket
- npm.io page: https://npm.io/package/docparse-scraper-status-socket

## Dependencies (7)

- [should](https://npm.io/package/should.md) ~1.2.2
- [express](https://npm.io/package/express.md) ~3.1.1
- [request](https://npm.io/package/request.md) ~2.16.6
- [seaport](https://npm.io/package/seaport.md) ~1.5.0
- [api-auth](https://npm.io/package/api-auth.md) ~1.0.4
- [required-keys](https://npm.io/package/required-keys.md) ~1.0.4
- [loggly-console-logger](https://npm.io/package/loggly-console-logger.md) ~1.0.5

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.13 (latest) — 2013-05-03
- 1.0.12 — 2013-04-08
- 1.0.11 — 2013-03-28
- 1.0.10 — 2013-03-26
- 1.0.9 — 2013-03-26
- 1.0.8 — 2013-03-26
- 1.0.7 — 2013-03-26
- 1.0.6 — 2013-03-26
- 1.0.4 — 2013-03-26
- 1.0.3 — 2013-03-26
- 1.0.2 — 2013-03-26
- 1.0.0 — 2013-03-26

## README

# Scraper Status Socket
Allow node.js based scrapers to connect to a status socket so that external services can query the current status of the scraper and check if it is running or stopped.

When a scraper starts up, it registers a new service with seaport using the role **scraperStatusSupplierCode**. For example the NGrid Electric scraper has the supplierCode **NGE** so it would register with the role **scraperStatusNGE**

Then this module will *connect* to an axon rep socket on the port returned by seaport.


# Querying
To query the status of a scraper, get the port of the status socket from seaport and send a *status* request over http

```javascript
var inspect = require('eyespect').inspector();
var request = require('request')
var config = require('nconf')
var supplierCode = 'NGE'
var seaConfig = config.get('seaport')
var seaHost = seaConfig.host
var seaPort = seaConfig.port
var ports = seaport.connect(seaHost, seaPort)
var role = 'scraperStatus' + supplierCode // eg "scraperStatusNGE"
var scraperServices = ports.query(role) // an array of services
var scraperService = scraperServices[0] // use the first one as an example
var statusHost = scraperService.host
var statusPort = scraperService.port

var url = 'http://' + statusHost + ':' + statusPort + '/status'
var opts = {
  url: url,
  json: true
}
request(opts, function (err, res, reply) {
  if (err) {
    inspect(err, 'error getting status of scraper')
    return
  }
  inspect(reply, 'scraper status reply')
})
```

The reply is json and should look like
```javascript
reply = {
  "supplierCode": "NGE",
  "status": "running",
  "running": true
}
```

---
_Source: https://npm.io/package/docparse-scraper-status-socket · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
