Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Server Sent Event support #1346
Comments
|
I was in need of server send events as well. Therefore i created this little library: https://github.com/liquidblock/yew-sse match self.sse.open(
&url,
self.link.callback(move |(id, message): (String, String)| {
Message::SendEventMessage(id, message)
}),
self.link.callback(move |value: EventSourceUpdate| {
match value {
EventSourceUpdate::Open => Message::SendEventOpen,
EventSourceUpdate::Error => Message::SendEventError,
}
}),
) {
Ok(task) => {
self.task = Some(task);
}
Err(e) => {
// error handling
}
}
The library works with |
|
I'm going to start taking a look at this |
Describe the feature you'd like
Adding a
yew::servicefor Server Sent Events, I imagine this one wouldn't be too difficult to add as it would behave similar to a one-way Websocket, and web_sys has support for the EventSource object.Describe alternatives you've considered (Optional)
While this can handled with Websockets as an alternative, the use cases are somewhat different, owing to communication being uni-directional.
Questionnaire