You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once #42 is implemented, the ability to directly modify the internal session buffer with the .event, .data, .id, .retry, .comment, .dispatch and .flush methods will be moved into a separate EventBuffer class that Session will create and use internally.
As such, these methods and the ability to modify the internal session buffer at all will become redundant as you can instead just instantiate a new EventBuffer yourself and write its data directly to the socket.
For example, where before you would modify the session buffer yourself to write individual fields:
constsession=awaitcreateSession(req,res);session.event("my-event").id("my-custom-id").data("my data 1").data("my data 2").dispatch().flush();
You can now create your own buffer instead:
constbuffer=createEventBuffer();buffer.event("my-event").id("my-custom-id").data("my data 1").data("my data 2").dispatch();res.write(buffer.read());
(The above code is not necessarily what the final API will look like.)
This avoids the need to instantiate an entire Session instance for users who simply want an easy way to write spec-compliant SSE fields over the wire, as well as reducing the API surface size for users who follow the most common use-case of only using the helper methods (.push, .stream and .iterate).
The aforementioned methods on the Session class are now deprecated and will be removed in the future. Possibly in version 1.0.0.
The text was updated successfully, but these errors were encountered:
Once #42 is implemented, the ability to directly modify the internal session buffer with the
.event
,.data
,.id
,.retry
,.comment
,.dispatch
and.flush
methods will be moved into a separateEventBuffer
class thatSession
will create and use internally.As such, these methods and the ability to modify the internal session buffer at all will become redundant as you can instead just instantiate a new
EventBuffer
yourself and write its data directly to the socket.For example, where before you would modify the session buffer yourself to write individual fields:
You can now create your own buffer instead:
(The above code is not necessarily what the final API will look like.)
This avoids the need to instantiate an entire
Session
instance for users who simply want an easy way to write spec-compliant SSE fields over the wire, as well as reducing the API surface size for users who follow the most common use-case of only using the helper methods (.push
,.stream
and.iterate
).The aforementioned methods on the
Session
class are now deprecated and will be removed in the future. Possibly in version1.0.0
.The text was updated successfully, but these errors were encountered: