An example for a live patient-provider chat using Medplum's WebSocket subscriptions.
This example app demonstrates the following:
- Creating WebSocket
Subscription
resource and connecting and listening to events - Loading chat history from FHIR server on initial load
- Sending chat messages by creating new
Communication
resources - Marking a message as received or read by updating received
Communication
resources from other chat participant - Parsing
Communication
resources and displaying message contents as well as read receipts, message timestamps, etc.
If you haven't already done so, follow the instructions in this tutorial to register a Medplum project to store your data.
Fork and clone the repo.
Next, install the dependencies
npm install
Then, run the app
npm run dev
This app should run on http://localhost:3000/
Note
Because WebSocket Subscriptions
are currently experimental, the websocket-subscriptions
feature flag needs to be enabled on your Project
resource for this demo to work.
To do this on a local dev server, login to @medplum/app
as the Super Admin
user and edit your Project
resource.
Note that a Project Admin
cannot edit Project.features
and it must be done by a Super Admin
.
Please contact Medplum if you would like to enable this on your project on the Medplum
hosted instance.
Medplum is an open-source, API-first EHR. Medplum makes it easy to build healthcare apps quickly with less code.
Medplum supports self-hosting, and provides a hosted service. Medplum Hello World uses the hosted service as a backend.
- Read our documentation
- Browse our react component library
- Join our Discord