Struct lib::Publisher[][src]

pub struct Publisher { /* fields omitted */ }
Expand description

The system that publishes data from the queries/mutations system to the subscriptions server. These communications are secured by a JWT specified in Options. This is automatically created from the Options and passed to all resolvers. You should never need to manually create it.

Implementations

Creates a new publisher. This is done for you when you create the queries/mutations system, so you should never need to call this.

Sends the given data to the subscriptions server on the given channel. In-depth information about this process is available in the book. You should use serde to serialize anything sent here as a string (this won’t be done for you). It should then be deserialized in the appropriate subscription (which will listen for messages from here indirectly). This function will return an error if the subscriptions server was unavailable or didn’t correctly acknowledge the request.

Example

let publisher = ctx.data::<Publisher>()?; // Where `ctx` is the `async_graphql` context to a resolver.
publisher.publish("new_user", user_json.to_string()).await?;

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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more