pub struct GraphQLSubscription<E, OnInit> { /* private fields */ }
Expand description
A builder for websocket subscription actor.
Implementations
sourceimpl<E, OnInit, OnInitFut> GraphQLSubscription<E, OnInit>where
E: Executor,
OnInit: FnOnce(Value) -> OnInitFut + Unpin + Send + 'static,
OnInitFut: Future<Output = Result<Data>> + Send + 'static,
impl<E, OnInit, OnInitFut> GraphQLSubscription<E, OnInit>where
E: Executor,
OnInit: FnOnce(Value) -> OnInitFut + Unpin + Send + 'static,
OnInitFut: Future<Output = Result<Data>> + Send + 'static,
sourcepub fn with_data(self, data: Data) -> Self
pub fn with_data(self, data: Data) -> Self
Specify the initial subscription context data, usually you can get something from the incoming request to create it.
sourcepub fn on_connection_init<OnConnInit2, Fut>(
self,
callback: OnConnInit2
) -> GraphQLSubscription<E, OnConnInit2>where
OnConnInit2: FnOnce(Value) -> Fut + Unpin + Send + 'static,
Fut: Future<Output = Result<Data>> + Send + 'static,
pub fn on_connection_init<OnConnInit2, Fut>(
self,
callback: OnConnInit2
) -> GraphQLSubscription<E, OnConnInit2>where
OnConnInit2: FnOnce(Value) -> Fut + Unpin + Send + 'static,
Fut: Future<Output = Result<Data>> + Send + 'static,
Specify a callback function to be called when the connection is initialized.
You can get something from the payload of GQL_CONNECTION_INIT
message to create Data
.
The data returned by this callback function will be merged with the data
specified by [with_data
].
sourcepub fn start<S>(
self,
request: &HttpRequest,
stream: S
) -> Result<HttpResponse, Error>where
S: Stream<Item = Result<Bytes, PayloadError>> + 'static,
pub fn start<S>(
self,
request: &HttpRequest,
stream: S
) -> Result<HttpResponse, Error>where
S: Stream<Item = Result<Bytes, PayloadError>> + 'static,
Start the subscription actor.
Auto Trait Implementations
impl<E, OnInit> !RefUnwindSafe for GraphQLSubscription<E, OnInit>
impl<E, OnInit> Send for GraphQLSubscription<E, OnInit>where
E: Send,
OnInit: Send,
impl<E, OnInit> Sync for GraphQLSubscription<E, OnInit>where
E: Sync,
OnInit: Sync,
impl<E, OnInit> Unpin for GraphQLSubscription<E, OnInit>where
E: Unpin,
OnInit: Unpin,
impl<E, OnInit> !UnwindSafe for GraphQLSubscription<E, OnInit>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more