[−][src]Trait async_graphql::SubscriptionTransport
Subscription transport
You can customize your transport by implementing this trait.
Required methods
fn handle_request<Query, Mutation, Subscription>(
&mut self,
schema: &Schema<Query, Mutation, Subscription>,
stubs: &mut SubscriptionStubs<Query, Mutation, Subscription>,
data: Bytes
) -> Result<Option<Bytes>> where
Query: ObjectType + Sync + Send + 'static,
Mutation: ObjectType + Sync + Send + 'static,
Subscription: SubscriptionType + Sync + Send + 'static,
&mut self,
schema: &Schema<Query, Mutation, Subscription>,
stubs: &mut SubscriptionStubs<Query, Mutation, Subscription>,
data: Bytes
) -> Result<Option<Bytes>> where
Query: ObjectType + Sync + Send + 'static,
Mutation: ObjectType + Sync + Send + 'static,
Subscription: SubscriptionType + Sync + Send + 'static,
Parse the request data here.
If you have a new request, create a SubscriptionStub
with the Schema::create_subscription_stub
, and then call SubscriptionStubs::add
.
You can return a Byte
, which will be sent to the client. If it returns an error, the connection will be broken.
fn handle_response(&mut self, id: usize, result: Result<Value>) -> Option<Bytes>
When a response message is generated, you can convert the message to the format you want here.
Implementors
impl SubscriptionTransport for WebSocketTransport
[src]
fn handle_request<Query, Mutation, Subscription>(
&mut self,
schema: &Schema<Query, Mutation, Subscription>,
stubs: &mut SubscriptionStubs<Query, Mutation, Subscription>,
data: Bytes
) -> Result<Option<Bytes>> where
Query: ObjectType + Sync + Send + 'static,
Mutation: ObjectType + Sync + Send + 'static,
Subscription: SubscriptionType + Sync + Send + 'static,
[src]
&mut self,
schema: &Schema<Query, Mutation, Subscription>,
stubs: &mut SubscriptionStubs<Query, Mutation, Subscription>,
data: Bytes
) -> Result<Option<Bytes>> where
Query: ObjectType + Sync + Send + 'static,
Mutation: ObjectType + Sync + Send + 'static,
Subscription: SubscriptionType + Sync + Send + 'static,