Update MVCFramework.SSEClient.pas (#782)
Some checks are pending
TOC Generator / TOC Generator (push) Waiting to run

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"}
This commit is contained in:
John Smith 2024-09-25 21:27:53 +02:00 committed by GitHub
parent edbf90e8ee
commit d3525deadc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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