How to add a payload for the server sent events? #396
Unanswered
manzaloros
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Convert the value to a string, then parse it client-side // server-side
let data = {
foo: 'bar',
baz: [
{
qux: 'hello world'
}
]
}
send({ data: JSON.stringify(data) }) // client-side
let data = useEventSource("/endpoint");
let parsed = data ? JSON.parse(data) : null)
// use parsed |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I send an object payload to the
eventStream
function in my resource route from the UI?Let's say I want to send an object like
to start the eventStream. The object is dependent on some form data from the user on the UI.
How would I do this?
Beta Was this translation helpful? Give feedback.
All reactions