From a7aaf24a5ca917e1d0cd5fcdbed3bb452b2bdff6 Mon Sep 17 00:00:00 2001 From: calderonsamuel Date: Sun, 7 Jan 2024 20:06:51 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20calderon?= =?UTF-8?q?samuel/SSEparser@b4ada1083ce36ab84d402856c017eb6e1f3fe545=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- authors.html | 4 ++-- index.html | 11 ++++++----- pkgdown.yml | 2 +- search.json | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/authors.html b/authors.html index 8380744..a8a18cd 100644 --- a/authors.html +++ b/authors.html @@ -56,7 +56,7 @@

Authors

Citation

Source: DESCRIPTION

-

Calderon S (2023). +

Calderon S (2024). SSEparser: Parse Server-Sent Events. R package version 0.1.0.9000, https://calderonsamuel.github.io/SSEparser/, https://github.com/calderonsamuel/SSEparser. @@ -64,7 +64,7 @@

Citation

@Manual{,
   title = {SSEparser: Parse Server-Sent Events},
   author = {Samuel Calderon},
-  year = {2023},
+  year = {2024},
   note = {R package version 0.1.0.9000, 
 https://calderonsamuel.github.io/SSEparser/},
   url = {https://github.com/calderonsamuel/SSEparser},
diff --git a/index.html b/index.html
index 444b00b..f6b5faf 100644
--- a/index.html
+++ b/index.html
@@ -129,7 +129,7 @@ 

Use in HTTP requestsstr(parser$events) #> List of 3 #> $ :List of 3 -#> ..$ event: chr "message" +#> ..$ event: chr "error" #> ..$ data : chr "{\"event\":\"message\",\"request\":\"POST\"}" #> ..$ id : chr "1" #> $ :List of 3 @@ -137,7 +137,7 @@

Use in HTTP requests#> ..$ data : chr "{\"event\":\"message\",\"request\":\"POST\"}" #> ..$ id : chr "2" #> $ :List of 3 -#> ..$ event: chr "error" +#> ..$ event: chr "message" #> ..$ data : chr "{\"event\":\"message\",\"request\":\"POST\"}" #> ..$ id : chr "3"

@@ -168,7 +168,7 @@

Extending SSEparser#> self$events <- c(self$events, list(parsed_event)) #> invisible(self) #> } -#> <bytecode: 0x0000022528581ce8> +#> <bytecode: 0x000001d822070e00> #> <environment: namespace:SSEparser>

CustomParser uses jsonlite::fromJSON() to parse the data field of every chunk in the event stream. We can now use our custom class with the previous request1.

@@ -187,7 +187,7 @@ 

Extending SSEparserstr(parser$events) #> List of 3 #> $ :List of 3 -#> ..$ event: chr "message" +#> ..$ event: chr "notification" #> ..$ data :List of 2 #> .. ..$ event : chr "message" #> .. ..$ request: chr "POST" @@ -199,7 +199,7 @@

Extending SSEparser#> .. ..$ request: chr "POST" #> ..$ id : chr "2" #> $ :List of 3 -#> ..$ event: chr "ping" +#> ..$ event: chr "info" #> ..$ data :List of 2 #> .. ..$ event : chr "message" #> .. ..$ request: chr "POST" @@ -256,6 +256,7 @@

Dev status

  • CRAN status
  • R-CMD-check
  • Codecov test coverage
  • +
  • CRAN RStudio mirror downloads
  • diff --git a/pkgdown.yml b/pkgdown.yml index c7d4afd..6b61b5e 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -2,7 +2,7 @@ pandoc: 2.19.2 pkgdown: 2.0.7 pkgdown_sha: ~ articles: {} -last_built: 2023-12-18T11:29Z +last_built: 2024-01-07T20:06Z urls: reference: https://calderonsamuel.github.io/SSEparser/reference article: https://calderonsamuel.github.io/SSEparser/articles diff --git a/search.json b/search.json index 6abfb55..8aa95e1 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":[]},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement codeofconduct@posit.co. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to SSEparser","title":"Contributing to SSEparser","text":"outlines propose change SSEparser. detailed discussion contributing tidyverse packages, please see development contributing guide code review principles.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to SSEparser","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to SSEparser","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See guide create great issue advice.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to SSEparser","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"calderonsamuel/SSEparser\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to SSEparser","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to SSEparser","text":"Please note SSEparser project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 Samuel Calderon Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with SSEparser","title":"Getting help with SSEparser","text":"Thanks using SSEparser! filing issue, places explore pieces put together make process smooth possible.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with SSEparser","text":"Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). additional reprex pointers, check Get help! section tidyverse site.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/SUPPORT.html","id":"where-to-ask","dir":"","previous_headings":"","what":"Where to ask?","title":"Getting help with SSEparser","text":"Armed reprex, next step figure ask. ’s question: start community.rstudio.com, /StackOverflow. people answer questions. ’s bug: ’re right place, file issue. ’re sure: let community help figure ! problem bug feature request, can easily return report . opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/SUPPORT.html","id":"what-happens-next","dir":"","previous_headings":"","what":"What happens next?","title":"Getting help with SSEparser","text":"efficient possible, development tidyverse packages tends bursty, shouldn’t worry don’t get immediate response. Typically don’t look repo sufficient quantity issues accumulates, ’s burst intense activity focus efforts. makes development efficient avoids expensive context switching problems, cost taking longer get back . process makes good reprex particularly important might multiple months initial report start working . can’t reproduce bug, can’t fix !","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Samuel Calderon. Author, maintainer, copyright holder.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Calderon S (2023). SSEparser: Parse Server-Sent Events. R package version 0.1.0.9000, https://calderonsamuel.github.io/SSEparser/, https://github.com/calderonsamuel/SSEparser.","code":"@Manual{, title = {SSEparser: Parse Server-Sent Events}, author = {Samuel Calderon}, year = {2023}, note = {R package version 0.1.0.9000, https://calderonsamuel.github.io/SSEparser/}, url = {https://github.com/calderonsamuel/SSEparser}, }"},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"sseparser","dir":"","previous_headings":"","what":"Parse Server-Sent Events","title":"Parse Server-Sent Events","text":"goal SSEparser provide robust functionality parse Server-Sent Events build top .","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Parse Server-Sent Events","text":"can install SEEparser CRAN like : Alternatively, can install development version like :","code":"install.packages(\"gptstudio\") pak::pak(\"calderonsamuel/SSEparser\")"},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Parse Server-Sent Events","text":"parse_sse() function takes string containing server-sent event converts R list. Comments usually received line starting colon. parsed.","code":"library(SSEparser) event <- \"data: test\\nevent: message\\nid: 123\\n\\n\" parse_sse(event) #> [[1]] #> [[1]]$data #> [1] \"test\" #> #> [[1]]$event #> [1] \"message\" #> #> [[1]]$id #> [1] \"123\" with_comment <- \"data: test\\n: comment\\nevent: example\\n\\n\" parse_sse(with_comment) #> [[1]] #> [[1]]$data #> [1] \"test\" #> #> [[1]]$event #> [1] \"example\""},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"use-in-http-requests","dir":"","previous_headings":"","what":"Use in HTTP requests","title":"Parse Server-Sent Events","text":"parse_sse() wraps SSEparser R6 class, also exported used real-time streaming data. following code handles request MIME type “text/event-stream”.","code":"parser <- SSEparser$new() response <- httr2::request(\"https://postman-echo.com/server-events/3\") %>% httr2::req_body_json(data = list( event = \"message\", request = \"POST\" )) %>% httr2::req_perform_stream(callback = \\(x) { event <- rawToChar(x) parser$parse_sse(event) TRUE }) str(parser$events) #> List of 3 #> $ :List of 3 #> ..$ event: chr \"message\" #> ..$ data : chr \"{\\\"event\\\":\\\"message\\\",\\\"request\\\":\\\"POST\\\"}\" #> ..$ id : chr \"1\" #> $ :List of 3 #> ..$ event: chr \"message\" #> ..$ data : chr \"{\\\"event\\\":\\\"message\\\",\\\"request\\\":\\\"POST\\\"}\" #> ..$ id : chr \"2\" #> $ :List of 3 #> ..$ event: chr \"error\" #> ..$ data : chr \"{\\\"event\\\":\\\"message\\\",\\\"request\\\":\\\"POST\\\"}\" #> ..$ id : chr \"3\""},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"extending-sseparser","dir":"","previous_headings":"","what":"Extending SSEparser","title":"Parse Server-Sent Events","text":"Following previous example, useful parse content every data field also R list instead JSON string. , can create new R6 class inherits SSEparser. just need overwrite append_parsed_sse() method. Notice thing modifying parsing data field, parsing event . original method SSEparser: CustomParser uses jsonlite::fromJSON() parse data field every chunk event stream. can now use custom class previous request1. Now instead JSON string can R list data field stream still process.","code":"CustomParser <- R6::R6Class( classname = \"CustomParser\", inherit = SSEparser, public = list( initialize = function() { super$initialize() }, append_parsed_sse = function(parsed_event) { parsed_event$data <- jsonlite::fromJSON(parsed_event$data) self$events = c(self$events, list(parsed_event)) invisible(self) } ) ) SSEparser$public_methods$append_parsed_sse #> function (parsed_event) #> { #> self$events <- c(self$events, list(parsed_event)) #> invisible(self) #> } #> #> parser <- CustomParser$new() response <- httr2::request(\"https://postman-echo.com/server-events/3\") %>% httr2::req_body_json(data = list( event = \"message\", request = \"POST\" )) %>% httr2::req_perform_stream(callback = \\(x) { event <- rawToChar(x) parser$parse_sse(event) TRUE }) str(parser$events) #> List of 3 #> $ :List of 3 #> ..$ event: chr \"message\" #> ..$ data :List of 2 #> .. ..$ event : chr \"message\" #> .. ..$ request: chr \"POST\" #> ..$ id : chr \"1\" #> $ :List of 3 #> ..$ event: chr \"message\" #> ..$ data :List of 2 #> .. ..$ event : chr \"message\" #> .. ..$ request: chr \"POST\" #> ..$ id : chr \"2\" #> $ :List of 3 #> ..$ event: chr \"ping\" #> ..$ data :List of 2 #> .. ..$ event : chr \"message\" #> .. ..$ request: chr \"POST\" #> ..$ id : chr \"3\""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse a Server Sent Event — SSEparser","title":"Parse a Server Sent Event — SSEparser","text":"class can help parse single server sent event stream . can inherit class custom application. parse_sse() function wraps class functional approach.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parse a Server Sent Event — SSEparser","text":"object R6 class SSEparser","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Parse a Server Sent Event — SSEparser","text":"HTML specification tells us event streams composed chunks (also called blocks, messages) lines. single new line character (\\n) states end line, two consecutive new line characters (\\n\\n) state end chunk. means , practice, event can composed one chunks, chunk can composed one lines. Typically, event stream send single chunk event, important understand event != chunk SSEparser$events list chunks received makes consistent output.","code":"data: This is the first chunk, it has one line data: This is the second chunk extra: It has two lines data: This is the third chunk, it has an id field. This is common. id: 123 : Lines that start with a colon are comments, they will be ignored data: This is the forth chunk, it has a comment data: This is the fifth chunk. Normally you will receive a data field custom: But the server can send custom field names. SSEparser parses them too."},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"public-fields","dir":"Reference","previous_headings":"","what":"Public fields","title":"Parse a Server Sent Event — SSEparser","text":"events List contains events parsed. class initialized, just empty list.","code":""},{"path":[]},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"Parse a Server Sent Event — SSEparser","text":"SSEparser$append_parsed_sse() SSEparser$parse_sse() SSEparser$new() SSEparser$clone()","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"method-append-parsed-sse-","dir":"Reference","previous_headings":"","what":"Method append_parsed_sse()","title":"Parse a Server Sent Event — SSEparser","text":"Takes parsed event appends events field. can overwrite method decide extend class.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a Server Sent Event — SSEparser","text":"","code":"SSEparser$append_parsed_sse(parsed_event)"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse a Server Sent Event — SSEparser","text":"parsed_event Event append events field.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"method-parse-sse-","dir":"Reference","previous_headings":"","what":"Method parse_sse()","title":"Parse a Server Sent Event — SSEparser","text":"Takes string comes server sent event parses R list. never overwrite method.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a Server Sent Event — SSEparser","text":"","code":"SSEparser$parse_sse(event)"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse a Server Sent Event — SSEparser","text":"event length 1 string containing server sent event specified HTML spec.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"Parse a Server Sent Event — SSEparser","text":"Create new SSE parser","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a Server Sent Event — SSEparser","text":"","code":"SSEparser$new()"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"Parse a Server Sent Event — SSEparser","text":"objects class cloneable method.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a Server Sent Event — SSEparser","text":"","code":"SSEparser$clone(deep = FALSE)"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse a Server Sent Event — SSEparser","text":"deep Whether make deep clone.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parse a Server Sent Event — SSEparser","text":"","code":"example_event <- \"data: This is the first chunk, it has one line data: This is the second chunk extra: It has two lines data: This is the third chunk, it has an id field. This is common. id: 123 : Lines that start with a colon are comments, they will be ignored data: This is the fourth chunk, it has a comment data: This is the fifth chunk. Normally you will receive a data field custom: But the server can send custom field names. SSEparser parses them too.\" parser <- SSEparser$new() parser$parse_sse(example_event) str(parser$events) #> List of 5 #> $ :List of 1 #> ..$ data: chr \"This is the first chunk, it has one line\" #> $ :List of 2 #> ..$ data : chr \"This is the second chunk\" #> ..$ extra: chr \"It has two lines\" #> $ :List of 2 #> ..$ data: chr \"This is the third chunk, it has an id field. This is common.\" #> ..$ id : chr \"123\" #> $ :List of 1 #> ..$ data: chr \"This is the fourth chunk, it has a comment\" #> $ :List of 2 #> ..$ data : chr \"This is the fifth chunk. Normally you will receive a data field\" #> ..$ custom: chr \"But the server can send custom field names. SSEparser parses them too.\""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse Server-Sent Events — parse_sse","title":"Parse Server-Sent Events — parse_sse","text":"functions converts Server-Sent Events R list. wrapper function lower level SSEparser R6 class. single string can contain multiple SSEs.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse Server-Sent Events — parse_sse","text":"","code":"parse_sse(event)"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse Server-Sent Events — parse_sse","text":"event length 1 string containing server sent event specified HTML spec.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parse Server-Sent Events — parse_sse","text":"R list element event","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parse Server-Sent Events — parse_sse","text":"","code":"event <- \"data: test\\nevent: message\\nid: 123\\n\\n\" parse_sse(event) #> [[1]] #> [[1]]$data #> [1] \"test\" #> #> [[1]]$event #> [1] \"message\" #> #> [[1]]$id #> [1] \"123\" #> #> with_comment <- \"data: test\\n: comment\\nevent: example\\n\\n\" parse_sse(with_comment) #> [[1]] #> [[1]]$data #> [1] \"test\" #> #> [[1]]$event #> [1] \"example\" #> #>"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":[]},{"path":"https://calderonsamuel.github.io/SSEparser/news/index.html","id":"sseparser-010","dir":"Changelog","previous_headings":"","what":"SSEparser 0.1.0","title":"SSEparser 0.1.0","text":"CRAN release: 2023-12-14 Export SSEparser class, parse_sse() function higher level wrapper.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/news/index.html","id":"sseparser-0009000","dir":"Changelog","previous_headings":"","what":"SSEparser 0.0.0.9000","title":"SSEparser 0.0.0.9000","text":"Added NEWS.md file track changes package.","code":""}] +[{"path":[]},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"our-pledge","dir":"","previous_headings":"","what":"Our Pledge","title":"Contributor Covenant Code of Conduct","text":"members, contributors, leaders pledge make participation community harassment-free experience everyone, regardless age, body size, visible invisible disability, ethnicity, sex characteristics, gender identity expression, level experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, sexual identity orientation. pledge act interact ways contribute open, welcoming, diverse, inclusive, healthy community.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"our-standards","dir":"","previous_headings":"","what":"Our Standards","title":"Contributor Covenant Code of Conduct","text":"Examples behavior contributes positive environment community include: Demonstrating empathy kindness toward people respectful differing opinions, viewpoints, experiences Giving gracefully accepting constructive feedback Accepting responsibility apologizing affected mistakes, learning experience Focusing best just us individuals, overall community Examples unacceptable behavior include: use sexualized language imagery, sexual attention advances kind Trolling, insulting derogatory comments, personal political attacks Public private harassment Publishing others’ private information, physical email address, without explicit permission conduct reasonably considered inappropriate professional setting","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"enforcement-responsibilities","dir":"","previous_headings":"","what":"Enforcement Responsibilities","title":"Contributor Covenant Code of Conduct","text":"Community leaders responsible clarifying enforcing standards acceptable behavior take appropriate fair corrective action response behavior deem inappropriate, threatening, offensive, harmful. Community leaders right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct, communicate reasons moderation decisions appropriate.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"scope","dir":"","previous_headings":"","what":"Scope","title":"Contributor Covenant Code of Conduct","text":"Code Conduct applies within community spaces, also applies individual officially representing community public spaces. Examples representing community include using official e-mail address, posting via official social media account, acting appointed representative online offline event.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"enforcement","dir":"","previous_headings":"","what":"Enforcement","title":"Contributor Covenant Code of Conduct","text":"Instances abusive, harassing, otherwise unacceptable behavior may reported community leaders responsible enforcement codeofconduct@posit.co. complaints reviewed investigated promptly fairly. community leaders obligated respect privacy security reporter incident.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"enforcement-guidelines","dir":"","previous_headings":"","what":"Enforcement Guidelines","title":"Contributor Covenant Code of Conduct","text":"Community leaders follow Community Impact Guidelines determining consequences action deem violation Code Conduct:","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"id_1-correction","dir":"","previous_headings":"Enforcement Guidelines","what":"1. Correction","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Use inappropriate language behavior deemed unprofessional unwelcome community. Consequence: private, written warning community leaders, providing clarity around nature violation explanation behavior inappropriate. public apology may requested.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"id_2-warning","dir":"","previous_headings":"Enforcement Guidelines","what":"2. Warning","title":"Contributor Covenant Code of Conduct","text":"Community Impact: violation single incident series actions. Consequence: warning consequences continued behavior. interaction people involved, including unsolicited interaction enforcing Code Conduct, specified period time. includes avoiding interactions community spaces well external channels like social media. Violating terms may lead temporary permanent ban.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"id_3-temporary-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"3. Temporary Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: serious violation community standards, including sustained inappropriate behavior. Consequence: temporary ban sort interaction public communication community specified period time. public private interaction people involved, including unsolicited interaction enforcing Code Conduct, allowed period. Violating terms may lead permanent ban.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"id_4-permanent-ban","dir":"","previous_headings":"Enforcement Guidelines","what":"4. Permanent Ban","title":"Contributor Covenant Code of Conduct","text":"Community Impact: Demonstrating pattern violation community standards, including sustained inappropriate behavior, harassment individual, aggression toward disparagement classes individuals. Consequence: permanent ban sort public interaction within community.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CODE_OF_CONDUCT.html","id":"attribution","dir":"","previous_headings":"","what":"Attribution","title":"Contributor Covenant Code of Conduct","text":"Code Conduct adapted Contributor Covenant, version 2.1, available https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. Community Impact Guidelines inspired [Mozilla’s code conduct enforcement ladder][https://github.com/mozilla/inclusion]. answers common questions code conduct, see FAQ https://www.contributor-covenant.org/faq. Translations available https://www.contributor-covenant.org/translations.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to SSEparser","title":"Contributing to SSEparser","text":"outlines propose change SSEparser. detailed discussion contributing tidyverse packages, please see development contributing guide code review principles.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to SSEparser","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to SSEparser","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See guide create great issue advice.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to SSEparser","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"calderonsamuel/SSEparser\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to SSEparser","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to SSEparser","text":"Please note SSEparser project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 Samuel Calderon Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with SSEparser","title":"Getting help with SSEparser","text":"Thanks using SSEparser! filing issue, places explore pieces put together make process smooth possible.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with SSEparser","text":"Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). additional reprex pointers, check Get help! section tidyverse site.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/SUPPORT.html","id":"where-to-ask","dir":"","previous_headings":"","what":"Where to ask?","title":"Getting help with SSEparser","text":"Armed reprex, next step figure ask. ’s question: start community.rstudio.com, /StackOverflow. people answer questions. ’s bug: ’re right place, file issue. ’re sure: let community help figure ! problem bug feature request, can easily return report . opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/SUPPORT.html","id":"what-happens-next","dir":"","previous_headings":"","what":"What happens next?","title":"Getting help with SSEparser","text":"efficient possible, development tidyverse packages tends bursty, shouldn’t worry don’t get immediate response. Typically don’t look repo sufficient quantity issues accumulates, ’s burst intense activity focus efforts. makes development efficient avoids expensive context switching problems, cost taking longer get back . process makes good reprex particularly important might multiple months initial report start working . can’t reproduce bug, can’t fix !","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Samuel Calderon. Author, maintainer, copyright holder.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Calderon S (2024). SSEparser: Parse Server-Sent Events. R package version 0.1.0.9000, https://calderonsamuel.github.io/SSEparser/, https://github.com/calderonsamuel/SSEparser.","code":"@Manual{, title = {SSEparser: Parse Server-Sent Events}, author = {Samuel Calderon}, year = {2024}, note = {R package version 0.1.0.9000, https://calderonsamuel.github.io/SSEparser/}, url = {https://github.com/calderonsamuel/SSEparser}, }"},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"sseparser","dir":"","previous_headings":"","what":"Parse Server-Sent Events","title":"Parse Server-Sent Events","text":"goal SSEparser provide robust functionality parse Server-Sent Events build top .","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Parse Server-Sent Events","text":"can install SEEparser CRAN like : Alternatively, can install development version like :","code":"install.packages(\"gptstudio\") pak::pak(\"calderonsamuel/SSEparser\")"},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Parse Server-Sent Events","text":"parse_sse() function takes string containing server-sent event converts R list. Comments usually received line starting colon. parsed.","code":"library(SSEparser) event <- \"data: test\\nevent: message\\nid: 123\\n\\n\" parse_sse(event) #> [[1]] #> [[1]]$data #> [1] \"test\" #> #> [[1]]$event #> [1] \"message\" #> #> [[1]]$id #> [1] \"123\" with_comment <- \"data: test\\n: comment\\nevent: example\\n\\n\" parse_sse(with_comment) #> [[1]] #> [[1]]$data #> [1] \"test\" #> #> [[1]]$event #> [1] \"example\""},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"use-in-http-requests","dir":"","previous_headings":"","what":"Use in HTTP requests","title":"Parse Server-Sent Events","text":"parse_sse() wraps SSEparser R6 class, also exported used real-time streaming data. following code handles request MIME type “text/event-stream”.","code":"parser <- SSEparser$new() response <- httr2::request(\"https://postman-echo.com/server-events/3\") %>% httr2::req_body_json(data = list( event = \"message\", request = \"POST\" )) %>% httr2::req_perform_stream(callback = \\(x) { event <- rawToChar(x) parser$parse_sse(event) TRUE }) str(parser$events) #> List of 3 #> $ :List of 3 #> ..$ event: chr \"error\" #> ..$ data : chr \"{\\\"event\\\":\\\"message\\\",\\\"request\\\":\\\"POST\\\"}\" #> ..$ id : chr \"1\" #> $ :List of 3 #> ..$ event: chr \"message\" #> ..$ data : chr \"{\\\"event\\\":\\\"message\\\",\\\"request\\\":\\\"POST\\\"}\" #> ..$ id : chr \"2\" #> $ :List of 3 #> ..$ event: chr \"message\" #> ..$ data : chr \"{\\\"event\\\":\\\"message\\\",\\\"request\\\":\\\"POST\\\"}\" #> ..$ id : chr \"3\""},{"path":"https://calderonsamuel.github.io/SSEparser/index.html","id":"extending-sseparser","dir":"","previous_headings":"","what":"Extending SSEparser","title":"Parse Server-Sent Events","text":"Following previous example, useful parse content every data field also R list instead JSON string. , can create new R6 class inherits SSEparser. just need overwrite append_parsed_sse() method. Notice thing modifying parsing data field, parsing event . original method SSEparser: CustomParser uses jsonlite::fromJSON() parse data field every chunk event stream. can now use custom class previous request1. Now instead JSON string can R list data field stream still process.","code":"CustomParser <- R6::R6Class( classname = \"CustomParser\", inherit = SSEparser, public = list( initialize = function() { super$initialize() }, append_parsed_sse = function(parsed_event) { parsed_event$data <- jsonlite::fromJSON(parsed_event$data) self$events = c(self$events, list(parsed_event)) invisible(self) } ) ) SSEparser$public_methods$append_parsed_sse #> function (parsed_event) #> { #> self$events <- c(self$events, list(parsed_event)) #> invisible(self) #> } #> #> parser <- CustomParser$new() response <- httr2::request(\"https://postman-echo.com/server-events/3\") %>% httr2::req_body_json(data = list( event = \"message\", request = \"POST\" )) %>% httr2::req_perform_stream(callback = \\(x) { event <- rawToChar(x) parser$parse_sse(event) TRUE }) str(parser$events) #> List of 3 #> $ :List of 3 #> ..$ event: chr \"notification\" #> ..$ data :List of 2 #> .. ..$ event : chr \"message\" #> .. ..$ request: chr \"POST\" #> ..$ id : chr \"1\" #> $ :List of 3 #> ..$ event: chr \"message\" #> ..$ data :List of 2 #> .. ..$ event : chr \"message\" #> .. ..$ request: chr \"POST\" #> ..$ id : chr \"2\" #> $ :List of 3 #> ..$ event: chr \"info\" #> ..$ data :List of 2 #> .. ..$ event : chr \"message\" #> .. ..$ request: chr \"POST\" #> ..$ id : chr \"3\""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse a Server Sent Event — SSEparser","title":"Parse a Server Sent Event — SSEparser","text":"class can help parse single server sent event stream . can inherit class custom application. parse_sse() function wraps class functional approach.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parse a Server Sent Event — SSEparser","text":"object R6 class SSEparser","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Parse a Server Sent Event — SSEparser","text":"HTML specification tells us event streams composed chunks (also called blocks, messages) lines. single new line character (\\n) states end line, two consecutive new line characters (\\n\\n) state end chunk. means , practice, event can composed one chunks, chunk can composed one lines. Typically, event stream send single chunk event, important understand event != chunk SSEparser$events list chunks received makes consistent output.","code":"data: This is the first chunk, it has one line data: This is the second chunk extra: It has two lines data: This is the third chunk, it has an id field. This is common. id: 123 : Lines that start with a colon are comments, they will be ignored data: This is the forth chunk, it has a comment data: This is the fifth chunk. Normally you will receive a data field custom: But the server can send custom field names. SSEparser parses them too."},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"public-fields","dir":"Reference","previous_headings":"","what":"Public fields","title":"Parse a Server Sent Event — SSEparser","text":"events List contains events parsed. class initialized, just empty list.","code":""},{"path":[]},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"public-methods","dir":"Reference","previous_headings":"","what":"Public methods","title":"Parse a Server Sent Event — SSEparser","text":"SSEparser$append_parsed_sse() SSEparser$parse_sse() SSEparser$new() SSEparser$clone()","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"method-append-parsed-sse-","dir":"Reference","previous_headings":"","what":"Method append_parsed_sse()","title":"Parse a Server Sent Event — SSEparser","text":"Takes parsed event appends events field. can overwrite method decide extend class.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a Server Sent Event — SSEparser","text":"","code":"SSEparser$append_parsed_sse(parsed_event)"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse a Server Sent Event — SSEparser","text":"parsed_event Event append events field.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"method-parse-sse-","dir":"Reference","previous_headings":"","what":"Method parse_sse()","title":"Parse a Server Sent Event — SSEparser","text":"Takes string comes server sent event parses R list. never overwrite method.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"usage-1","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a Server Sent Event — SSEparser","text":"","code":"SSEparser$parse_sse(event)"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"arguments-1","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse a Server Sent Event — SSEparser","text":"event length 1 string containing server sent event specified HTML spec.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"method-new-","dir":"Reference","previous_headings":"","what":"Method new()","title":"Parse a Server Sent Event — SSEparser","text":"Create new SSE parser","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"usage-2","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a Server Sent Event — SSEparser","text":"","code":"SSEparser$new()"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"method-clone-","dir":"Reference","previous_headings":"","what":"Method clone()","title":"Parse a Server Sent Event — SSEparser","text":"objects class cloneable method.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"usage-3","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse a Server Sent Event — SSEparser","text":"","code":"SSEparser$clone(deep = FALSE)"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"arguments-2","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse a Server Sent Event — SSEparser","text":"deep Whether make deep clone.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/SSEparser.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parse a Server Sent Event — SSEparser","text":"","code":"example_event <- \"data: This is the first chunk, it has one line data: This is the second chunk extra: It has two lines data: This is the third chunk, it has an id field. This is common. id: 123 : Lines that start with a colon are comments, they will be ignored data: This is the fourth chunk, it has a comment data: This is the fifth chunk. Normally you will receive a data field custom: But the server can send custom field names. SSEparser parses them too.\" parser <- SSEparser$new() parser$parse_sse(example_event) str(parser$events) #> List of 5 #> $ :List of 1 #> ..$ data: chr \"This is the first chunk, it has one line\" #> $ :List of 2 #> ..$ data : chr \"This is the second chunk\" #> ..$ extra: chr \"It has two lines\" #> $ :List of 2 #> ..$ data: chr \"This is the third chunk, it has an id field. This is common.\" #> ..$ id : chr \"123\" #> $ :List of 1 #> ..$ data: chr \"This is the fourth chunk, it has a comment\" #> $ :List of 2 #> ..$ data : chr \"This is the fifth chunk. Normally you will receive a data field\" #> ..$ custom: chr \"But the server can send custom field names. SSEparser parses them too.\""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":null,"dir":"Reference","previous_headings":"","what":"Parse Server-Sent Events — parse_sse","title":"Parse Server-Sent Events — parse_sse","text":"functions converts Server-Sent Events R list. wrapper function lower level SSEparser R6 class. single string can contain multiple SSEs.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parse Server-Sent Events — parse_sse","text":"","code":"parse_sse(event)"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parse Server-Sent Events — parse_sse","text":"event length 1 string containing server sent event specified HTML spec.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parse Server-Sent Events — parse_sse","text":"R list element event","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/parse_sse.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parse Server-Sent Events — parse_sse","text":"","code":"event <- \"data: test\\nevent: message\\nid: 123\\n\\n\" parse_sse(event) #> [[1]] #> [[1]]$data #> [1] \"test\" #> #> [[1]]$event #> [1] \"message\" #> #> [[1]]$id #> [1] \"123\" #> #> with_comment <- \"data: test\\n: comment\\nevent: example\\n\\n\" parse_sse(with_comment) #> [[1]] #> [[1]]$data #> [1] \"test\" #> #> [[1]]$event #> [1] \"example\" #> #>"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/pipe.html","id":null,"dir":"Reference","previous_headings":"","what":"Pipe operator — %>%","title":"Pipe operator — %>%","text":"See magrittr::%>% details.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/pipe.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Pipe operator — %>%","text":"","code":"lhs %>% rhs"},{"path":"https://calderonsamuel.github.io/SSEparser/reference/pipe.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Pipe operator — %>%","text":"lhs value magrittr placeholder. rhs function call using magrittr semantics.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/reference/pipe.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Pipe operator — %>%","text":"result calling rhs(lhs).","code":""},{"path":[]},{"path":"https://calderonsamuel.github.io/SSEparser/news/index.html","id":"sseparser-010","dir":"Changelog","previous_headings":"","what":"SSEparser 0.1.0","title":"SSEparser 0.1.0","text":"CRAN release: 2023-12-14 Export SSEparser class, parse_sse() function higher level wrapper.","code":""},{"path":"https://calderonsamuel.github.io/SSEparser/news/index.html","id":"sseparser-0009000","dir":"Changelog","previous_headings":"","what":"SSEparser 0.0.0.9000","title":"SSEparser 0.0.0.9000","text":"Added NEWS.md file track changes package.","code":""}]