You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`--logDest <path>`: Set path for log files, and enable file logging
80
80
*`--logFile <filename>`: Set the name of the log file (without the path). Defaults to `highcharts-export-server.log`. Note that `--logDest` also needs to be set to enable file logging.
@@ -331,7 +332,7 @@ The export server can also be used as a node module to simplify integrations:
331
332
*`enableFileLogging(path, name)`: enable logging to file. `path` is the path to log to, `name` is the filename to log to
332
333
*`export(exportOptions, fn)`: do an export. `exportOptions` uses the same attribute names as the CLI switch names. `fn` is called when the export is completed, with an object as the second argument containing the the filename attribute.
333
334
*`startServer(port, sslPort, sslPath)`: start an http server on the given port. `sslPath` is the path to the server key/certificate (must be named server.key/server.crt)
334
-
*`server` - the server instance
335
+
*`server` - the server instance
335
336
*`enableRateLimiting(options)` - enable rate limiting on the POST path
336
337
*`max` - the maximum amount of requests before rate limiting kicks in
337
338
*`window` - the time window in minutes for rate limiting. Example: setting `window` to `1` and `max` to `30` will allow a maximum of 30 requests within one minute.
@@ -342,16 +343,17 @@ The export server can also be used as a node module to simplify integrations:
342
343
*`express()` - return the express module instance
343
344
*`useFilter(when, fn)` - attach a filter to the POST route. Returning false in the callback will terminate the request.
344
345
*`when` - either `beforeRequest` or `afterRequest`
345
-
*`fn` - the function to call
346
+
*`fn` - the function to call
346
347
*`req` - the request object
347
348
*`res` - the result object
348
349
*`data` - the request data
349
350
*`id` - the request ID
350
-
*`uniqueid` - the unique id for the request (used for temporary file names)
351
+
*`uniqueid` - the unique id for the request (used for temporary file names)
351
352
*`initPool(config)`: init the phantom pool - must be done prior to exporting. `config` is an object as such:
352
353
*`maxWorkers` (default 25) - max count of worker processes
353
354
*`initialWorkers` (default 5) - initial worker process count
354
355
*`workLimit` (default 50) - how many task can be performed by a worker process before it's automatically restarted
356
+
*`queueSize` (default 5) - how many request can be stored in overflow count when there are not enough workers to handle all requests
355
357
*`killPool()`: kill the phantom processes
356
358
357
359
## Using Ajax in Injected Resources
@@ -360,16 +362,16 @@ If you need to perform Ajax requests inside one of the resource scripts,
360
362
set `asyncRendering` to true, and call `highexp.done()` in the Ajax return to process the chart.
361
363
362
364
Example:
363
-
365
+
364
366
{
365
367
asyncRendering: true,
366
368
resources: {
367
-
files: 'myAjaxScript.js'
369
+
files: 'myAjaxScript.js'
368
370
}
369
371
}
370
372
371
373
myAjaxScript.js:
372
-
374
+
373
375
jQuery.ajax({
374
376
url: 'example.com',
375
377
success: function (data) {
@@ -381,16 +383,16 @@ myAjaxScript.js:
381
383
}
382
384
});
383
385
384
-
If the Ajax call doesn't call `highexp.done()` within 60 seconds, the
386
+
If the Ajax call doesn't call `highexp.done()` within 60 seconds, the
385
387
rendering will time out.
386
388
387
389
## Performance Notice
388
390
389
391
In cases of batch exports, it's faster to use the HTTP server than the CLI.
390
-
This is due to the overhead of starting PhantomJS for each job when using the CLI.
392
+
This is due to the overhead of starting PhantomJS for each job when using the CLI.
391
393
392
-
As a concrete example, running the CLI with [testcharts/basic.json](testcharts/basic.json)
393
-
as the input and converting to PNG averages about 449ms.
394
+
As a concrete example, running the CLI with [testcharts/basic.json](testcharts/basic.json)
395
+
as the input and converting to PNG averages about 449ms.
394
396
Posting the same configuration to the HTTP server averages less than 100ms.
395
397
396
398
So it's better to write a bash script that starts the server and then
@@ -399,7 +401,7 @@ export server as a service.
399
401
400
402
Alternatively, you can use the `--batch` switch if the output format is the same
0 commit comments