Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the names and IDs of SSE event streams to be prefixed (for composition) #161

Closed
danielfernandez opened this issue Oct 1, 2017 · 1 comment

Comments

@danielfernandez
Copy link
Member

Right now, when Thymeleaf generates a stream of SSE events, these events have the names:

  • head: for all markup that appears in the template before the iteration of the data-driver variable.
  • message: for each of the messages containing an iteration on the data-driver (actually an execution of the template engine for a buffer of elements produced by the data-driver).
  • tail: for all markup that appears in the template after the iteration of the data-driver variable.

But it would be a good idea to allow these event names (field event:) and also the event IDs (field id:) to be prefixed for a specific data-driven execution.

This way, if Thymeleaf is used in UI composition scenarios in which a large Flux<DataBuffer> is created as the composition of several executions of SpringWebFluxTemplateEngine (each of them creating a Flux<DataBuffer> for a specific data driver), so that these executions are not ordered in source but instead serve their DataBuffers towards the browser as soon as they are generated, we could have the different parts of a complex UI being rendered progressively and concurrently in HTML, and sent to the browser in the form of SSE events, which would then be very easy to discriminate in JavaScript by means of using EventSource objects with different callbacks being executed for each of the {prefix}_message events being received.

@danielfernandez
Copy link
Member Author

Already in 3.0.8-SNAPSHOT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant