mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-15 07:45:54 +01:00
Update MVCFramework.SSEClient.pas (#782)
Some checks are pending
TOC Generator / TOC Generator (push) Waiting to run
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:
parent
edbf90e8ee
commit
d3525deadc
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user