SSE parser using nimble parser

Hi All!

I playing with NimbleParsec and also I need in other project library for parsing server sent events, so I created SseParser.

What do you think?

1 Like

Cool. How about publishing this on Hex?

It already is, I forgot to add link to hex, here it is :slight_smile:

1 Like

I just published version 1.0.0 with updated api, instead of

[event: [field: [name: "event", value: "put"], field: [name: "test"], comment: "Text of comment"], event: ...]

is used

[{"event", "put"}, {"test", nil}, "Text of comment", [...

Published version 1.1.0 with implement event interpreting event according to section 6. of standard

  • all “id” fields are reduced to one with value from last
  • all “event” fields are reduced to one with last value
  • all “data” fields are reduced to one by joining them with newline as separator
  • all “retry” fields are reduced with value of last one that is valid integer
  • comments are ignored
  • other fields are ignored
  • field with empty value are ignored
1 Like

Very nice!

Would you be able to add a little detail to the README? Perhaps include an example and change the “if available” text.

2 Likes

Thank you for advice, I added usage to README and also linked it with version 1.1.1 to hexdocs :slight_smile:

1 Like

Another publish, now it is 2.0.0, event is now represented as struct instead of keyword list, so
result of interpret("event: test\n\n") is [%SseParser.Event{event: "test"}]

2 Likes

I like the new API :slight_smile:

I think your README example needs to be updated now!

2 Likes

Thank you, updated with release 2.0.1

New major published 3.0.0 because of ts_access update (removed SseParser.Event.*_lens functions.

1 Like