From d3525deadc0d49a0a78bf46055f8edabf09c5be3 Mon Sep 17 00:00:00 2001 From: John Smith <35150005+radexpol@users.noreply.github.com> Date: Wed, 25 Sep 2024 21:27:53 +0200 Subject: [PATCH] Update MVCFramework.SSEClient.pas (#782) Since the format of SSE contains spaces between command and value, we have to trim the value part. sample: event: userconnect data: {"username": "bobby", "time": "02:33:48"} --- sources/MVCFramework.SSEClient.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/MVCFramework.SSEClient.pas b/sources/MVCFramework.SSEClient.pas index feb3edb4..5fab4805 100644 --- a/sources/MVCFramework.SSEClient.pas +++ b/sources/MVCFramework.SSEClient.pas @@ -134,13 +134,13 @@ begin SSEMessage.Text := ASSEMessage; if SSEMessage.IndexOfName('id')>-1 then - fLastEventId := SSEMessage.Values['id'].ToInteger; + fLastEventId := SSEMessage.Values['id'].Trim.ToInteger; if SSEMessage.IndexOfName('event')>-1 then - event := SSEMessage.Values['event']; + event := SSEMessage.Values['event'].Trim; if SSEMessage.IndexOfName('data')>-1 then - data := SSEMessage.Values['data']; + data := SSEMessage.Values['data'].Trim; if SSEMessage.IndexOfName('retry')>-1 then - fReconnectTimeout := StrToIntDef(SSEMessage.Values['retry'], DefaultReconnectTimeout); + fReconnectTimeout := StrToIntDef(SSEMessage.Values['retry'].Trim, DefaultReconnectTimeout); fOnSSEEvent(Self, fLastEventId, event, data); finally