Lost connection handling
jsnlog.js keeps track of whether a log request to the server succeeded or failed.
If it failed, it retains them in the batch buffer
(which is used for
maxBatchSize limits number of messages kept
Limit how large the buffer can grow
by setting the appender option maxBatchSize
or on the server
When the server becomes reachable again, all messages in the batch buffer are sent in one big batch. If any messages were discarded, an additional log message with severity WARN will be sent in the same batch to let you know.
sendTimeout sets time between retries
The appender option sendTimeout is the time in milli seconds after which jsnlog.js gives up waiting for a response to a log request.
After a timeout, the old log request is aborted and a new log request sent with all the messages in the buffer. That means that if message were added to the buffer while the response was outstanding, those new messages will be sent as well.
jsnlog.js may find out well before this timeout that no success response will be received. For example, it will be told immediately by the browser that the connection to the Internet is gone when it tries to send a request. However, in order to not put too much load on the device, jsnlog.js will wait sendTimeout milli seconds anyway before sending another log request.