pub struct GraphQLSubscription<E, OnInit> { /* private fields */ }
Expand description
A builder for websocket subscription actor.
Implementations§
source§impl<E, OnInit, OnInitFut> GraphQLSubscription<E, OnInit>
impl<E, OnInit, OnInitFut> GraphQLSubscription<E, OnInit>
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>
pub fn on_connection_init<OnConnInit2, Fut>( self, callback: OnConnInit2 ) -> GraphQLSubscription<E, OnConnInit2>
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>
impl<E, OnInit> Sync for GraphQLSubscription<E, OnInit>
impl<E, OnInit> Unpin for GraphQLSubscription<E, OnInit>
impl<E, OnInit> !UnwindSafe for GraphQLSubscription<E, OnInit>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more