From 22ad970d426c07bb36c3f71856ba16183377a5f4 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 27 Nov 2023 19:11:56 +0700 Subject: all: handle reconnecting when streaming execution In "/awwan/api/execute/tail" SSE endpoint, in order for client to be able to reconnect and start streaming from the last know output, we need to send the ID for each message that we send. The ID is the index of Output in slice. If client does not send Last-Event-ID, we send all Output from beginning, otherwise, we send only message start from index in Last-Event-ID. --- testdata/http_server/execute/local_test.data | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'testdata') diff --git a/testdata/http_server/execute/local_test.data b/testdata/http_server/execute/local_test.data index a64b049..5cd6f5e 100644 --- a/testdata/http_server/execute/local_test.data +++ b/testdata/http_server/execute/local_test.data @@ -29,17 +29,22 @@ data: 2023-11-26T15:21:00Z event: message data: - local.aww === BEGIN: local /local.aww 1- +id: 0 event: message data: - local.aww --> 1: echo "test" +id: 1 event: message data: test +id: 2 event: message data: - local.aww === END +id: 3 event: end data: 2023-11-26T15:21:00Z +id: 3 -- cgit v1.3