pub struct EventSource { /* private fields */ }
Available on crate feature eventsource only.
Expand description

Wrapper around browser’s EventSource API. Dropping this will close the underlying event source.

Implementations§

Establish an EventSource.

This function may error in the following cases:

  • The connection url is invalid

The error returned is JsError. See the MDN Documentation to learn more.

Subscribes to listening for a specific type of event.

All events for this type are streamed back given the subscription returned.

The event type of “message” is a special case, as it will capture events without an event field as well as events that have the specific type event: message. It will not trigger on any other event type.

Closes the EventSource.

See the MDN Documentation to learn about this function

The current state of the EventSource.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.