owlservable 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dashboard.html CHANGED
@@ -303,6 +303,7 @@ document.getElementById('btn-clear').addEventListener('click',function(){
303
303
 
304
304
  function handleMsg(msg){
305
305
  if(msg.type==='init'){
306
+ reset();
306
307
  msg.requests.slice().reverse().forEach(function(r){addRow(r,false);});
307
308
  renderSave(msg.save);
308
309
  }else if(msg.type==='request'){
@@ -344,7 +345,7 @@ function connect(){
344
345
  btnPause.title='Resume ('+pauseBuffer.length+' buffered)';
345
346
  return;
346
347
  }
347
- handleMsg(msg);
348
+ try{handleMsg(msg);}catch(_){}
348
349
  });
349
350
  }
350
351
  connect();
package/index.cjs CHANGED
@@ -200,8 +200,8 @@ function patchHttpModule(mod, protocol) {
200
200
  const ct = res.headers['content-type'] || ''
201
201
  const isJson = ct.includes('application/json')
202
202
  const isSse = ct.includes('text/event-stream')
203
- const r = addRequest({ url, method: method.toUpperCase(), status: res.statusCode, latency: Date.now() - start, reqBody, metaPending: isJson || isSse })
204
- if (r && (isJson || isSse)) {
203
+ const r = addRequest({ url, method: method.toUpperCase(), status: res.statusCode, latency: Date.now() - start, reqBody, metaPending: isJson })
204
+ if (r && isJson) {
205
205
  try {
206
206
  const chunks = []; let size = 0
207
207
  res.on('data', chunk => { try { if (size < MAX_PARSE) { chunks.push(chunk); size += chunk.length } } catch (_) {} })
@@ -317,6 +317,7 @@ function startDashboard(port) {
317
317
  const urlPath = req.url?.split('?')[0] || '/'
318
318
 
319
319
  if (urlPath === '/events') {
320
+ try { req.socket.setNoDelay(true) } catch (_) {}
320
321
  res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive' })
321
322
  const send = d => { try { res.write('data: ' + JSON.stringify(d) + '\n\n') } catch (_) {} }
322
323
  send({ type: 'init', requests: getRequests(), save: getSaveInfo() })
package/index.js CHANGED
@@ -200,8 +200,8 @@ function patchHttpModule(mod, protocol) {
200
200
  const ct = res.headers['content-type'] || ''
201
201
  const isJson = ct.includes('application/json')
202
202
  const isSse = ct.includes('text/event-stream')
203
- const r = addRequest({ url, method: method.toUpperCase(), status: res.statusCode, latency: Date.now() - start, reqBody, metaPending: isJson || isSse })
204
- if (r && (isJson || isSse)) {
203
+ const r = addRequest({ url, method: method.toUpperCase(), status: res.statusCode, latency: Date.now() - start, reqBody, metaPending: isJson })
204
+ if (r && isJson) {
205
205
  try {
206
206
  const chunks = []; let size = 0
207
207
  res.on('data', chunk => { try { if (size < MAX_PARSE) { chunks.push(chunk); size += chunk.length } } catch (_) {} })
@@ -317,6 +317,7 @@ function startDashboard(port) {
317
317
  const urlPath = req.url?.split('?')[0] || '/'
318
318
 
319
319
  if (urlPath === '/events') {
320
+ try { req.socket.setNoDelay(true) } catch (_) {}
320
321
  res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive' })
321
322
  const send = d => { try { res.write('data: ' + JSON.stringify(d) + '\n\n') } catch (_) {} }
322
323
  send({ type: 'init', requests: getRequests(), save: getSaveInfo() })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "owlservable",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Minimalist Observability Platform. Zero config, zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "index.js",