i want take data for chat room beetween two users by subscription
i have schema like this
type User @withSubscription {
id: ID!
name: String!
email: String!
messages: [Message]
}
type Message @withSubscription {
id: ID!
message: String!
senderMail: String! @search(by: [hash, regexp, term])
receiverMail: String! @search(by: [hash, regexp, term])
timestamp: DateTime!
users: [User]
}
and take data like this
useSubscription(SUBSCRIPTION_QUERY,
{
variables: {filter: { senderMail: {in: [senderMail] }, receiverMail: {in: [email]}}},
}
);
but it give data only in one way - for sender email Messages only
i need to create new subscription like this
useSubscription(SUBSCRIPTION_QUERY,
{
variables: {filter: { senderMail: {in: [email] }, receiverMail: {in: [senderMail]}}},
}
);
it gives messages from recieverMail too
but maybe be way to create subscription for both cases