ThreadChat WebSocket connection in medplum-live-ch...
# support
s
Hello, I am trying to run medplum-live-chat-demo and I have encountered an issue related to the URL used by the ThreadChat component to create a WebSocket connection. My medplum instance is hosted on the "https:///api" URL which is automatically transformed into "wss:///ws/subscriptions-r4" when the live-chat app attempts to create a WebSocket connection. This causes the connection to fail because the correct URL would be "wss:///api/ws/subscriptions-r4". How can I prevent the ThreadChat component from using the URL without the "/api" part? Alternatively, when I run medplum locally on "http://localhost:8103" the medplum-live-chat-demo works without issues. Also FYI: I think you forgot to add the @medplum/mock package to the project's package.json. - Slawa
r
Hi @slawa_p , in this case your
baseUrl
for MedplumClient should be
https://<baseUrl>/api
, as this is the root of your Medplum API server
s
Yes, that is already the case.
I believe I have found the error. In
medplum/packages/core/src/client.ts
in line:
this.subscriptionManager = new SubscriptionManager(this, getWebSocketUrl('/ws/subscriptions-r4', this.baseUrl));
the path string
'/ws/subscriptions-r4'
should not begin with
'/'
, instead it should be just
'ws/subscriptions-r4'
.
t
@rahul1 Any idea when will this issue be resolved?
r
Hi @theurbanerrorist , @slawa_p - if you can write up a detailed issue in our Github issues, we can put it through our triage process
Most helpful would be a description on how we can reproduce this ssue
r
Hi @slawa_p , this has been fixed now! https://github.com/medplum/medplum/pull/4317
318 Views