We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Tested with wrangler@3.76.0 on macOS.
wrangler@3.76.0
It doesn't appear that the EventSource implementation conforms to the EventTarget interface and only provides the onmessage handler.
EventSource
EventTarget
onmessage
This appears to mean that streams where events use a named event field are not consumable as these are not passed to onmessage.
event
event: output data: hello world id: 1
According to MDN the addEventListener("output", fn) interface is used to consume these named events.
addEventListener("output", fn)
Example:
const source = new EventSource("http://example.com"); source.addEventListener("output", function (evt) {});
Output:
TypeError: source.addEventListener is not a function
If I try and consume the above stream with just onmessage:
source.onerror evt => console.error(evt) source.onmessage = evt => console.log(evt)
I get an error logged:
Error: The server disconnected.
The text was updated successfully, but these errors were encountered:
Make EventSource extend EventTarget
8492c5a
Fixes: #2698
Successfully merging a pull request may close this issue.
Tested with
wrangler@3.76.0
on macOS.It doesn't appear that the
EventSource
implementation conforms to theEventTarget
interface and only provides theonmessage
handler.This appears to mean that streams where events use a named
event
field are not consumable as these are not passed toonmessage
.According to MDN the
addEventListener("output", fn)
interface is used to consume these named events.Example:
Output:
If I try and consume the above stream with just
onmessage
:I get an error logged:
The text was updated successfully, but these errors were encountered: