EventSource
EventSource copied to clipboard
Update EventParser.swift to Support CR LF
PR for #27
Would you be able to add tests to verify your solution?
Hi. I have updated the code to support mixed CRLF and LFLF with tests. But I don't know if we should ever support mixed contents.
I don't think mixed content will ever be a case.
I'll check the PR and merge it ASAP. Thank you!
Would you like to implement the optimization on your side? Kinda busy right now :P
Sure, I'll give it a shot, and maybe I'll open a new PR
@Recouse think this PR will come in anytime soon? SSE spec says any of the 3 are supported "Lines must be separated by either a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair, a single U+000A LINE FEED (LF) character, or a single U+000D CARRIAGE RETURN (CR) character." so we are choking on spec compliant servers. Thanks! Have had terrific luck with your framework otherwise and appreciate you building it!
Maybe you can change Parser implementation from Data to String.
Use CharacterSet.whitespacesAndNewlines to avoid handle those.
I specifically used Data to avoid unnecessary conversions between Data and String. I have some drafts that add CRLF support, I haven't had the time to focus on them full-time, but I'll probably open a new PR as soon as it's ready.
Maybe you can change Parser implementation from
DatatoString.Use
CharacterSet.whitespacesAndNewlinesto avoid handle those.
You can't. Some of the data starts with white spaces. It was fixed earlier.
Maybe you can change Parser implementation from
DatatoString. UseCharacterSet.whitespacesAndNewlinesto avoid handle those.You can't. Some of the data starts with white spaces. It was fixed earlier.
CharacterSet.newlines ... I have a mistake.
@Recouse I have replace all function with O(n) cplx so would you please update with me?
I've been busy and haven't had time to review it yet. I'll take a look in the coming days, thanks for your contribution.
Everything looks good to me. There's just one small improvement I'd like to suggest, removing the Data → String → Data conversions in the cleanMessageData(_:) method. I've made the changes and tested them. If you add me as a contributor in your repo, I could push the updates to this PR branch.
Everything looks good to me. There's just one small improvement I'd like to suggest, removing the Data → String → Data conversions in the
cleanMessageData(_:)method. I've made the changes and tested them. If you add me as a contributor in your repo, I could push the updates to this PR branch.
Added.
Oops, I accidentally pushed everything to my repo instead of yours.