Implementing chat feature in react native using Ex...
# support
c
Hey everyone, I was trying to integrate realtime chat feature between Practitioner(Web) and Patient(Mobile App) using React Native Expo bare workflow. Is there any documentation that I can follow? TIA
p
@rahul1 Any thoughts?
r
HI @chinmay_mb , have you checked out our Medplum Chat Demo? this demonstrates how to make a full patient mesaging center based on websockets and the
Communication
resource. https://www.medplum.com/docs/communications
c
@rahul1 thanks! I'm using the useSubscription() hook to create a subscription and establish a WebSocket channel. When I log in as a practitioner, I'm able to trigger the addEventListener for receiving messages successfully. However, when I log in as a patient, the message listener isn’t triggered if the patient has an access policy assigned. Here’s an example of the access policy I’ve assigned to the patient: { "resourceType": "Subscription", "criteria": "Subscription?type=websocket&author=%profile" } Interestingly, if I don’t assign an access policy to the patient, the WebSocket connection works just fine and the addEventListener for messages is triggered as expected. Could there be additional permissions or configurations I need to assign to the patient’s access policy to allow them to receive WebSocket messages properly?