Skip to main content

core.fhircastconnection

Home > @medplum/core > FhircastConnection

FhircastConnection class

A class representing a FHIRcast connection.

FhircastConnection extends EventTarget and emits 3 lifecycle events: 1. connect - An event to signal when a WebSocket connection has been opened. Fired as soon as a WebSocket emits open. 2. message - Contains a payload field containing a FHIRcast message payload exactly as it comes in over WebSockets. 3. disconnect - An event to signal when a WebSocket connection has been closed. Fired as soon as a WebSocket emits close.

The underlying socket reconnects on its own, so disconnect followed by connect is the normal shape of a dropped connection rather than the end of the session. A subscription endpoint stays valid for the lease the Hub granted it, so reconnecting resubscribes without a new hub.subscribe request. Two things end a connection for good: calling connection.disconnect(), and the Hub denying the subscription — after either, connect will not fire again.

Signature:

export declare class FhircastConnection extends TypedEventTarget<FhircastSubscriptionEventMap>

Extends: TypedEventTarget<FhircastSubscriptionEventMap>

Constructors

Constructor

Modifiers

Description

(constructor)(subRequest, options)

Creates a new FhircastConnection.

Properties

Property

Modifiers

Type

Description

subRequest

readonly

SubscriptionRequest

Methods

Method

Modifiers

Description

disconnect()