Class: FhircastConnection
A class representing a FHIRcast
connection.
FhircastConnection
extends EventTarget
and emits 3 lifecycle events:
connect
- An event to signal when a WebSocket connection has been opened. Fired as soon as a WebSocket emitsopen
.message
- Contains apayload
field containing aFHIRcast
message payload exactly as it comes in over WebSockets.disconnect
- An event to signal when a WebSocket connection has been closed. Fired as soon as a WebSocket emitsclose
.
To close the connection, call connection.disconnect()
and listen to the disconnect
event to know when the connection has been disconnected.
Hierarchy
TypedEventTarget
<FhircastSubscriptionEventMap
>↳
FhircastConnection
Constructors
constructor
• new FhircastConnection(subRequest
)
Creates a new FhircastConnection
.
Parameters
Name | Type | Description |
---|---|---|
subRequest | SubscriptionRequest | The subscription request to initialize the connection from. |
Overrides
Defined in
packages/core/src/fhircast/index.ts:421
Properties
subRequest
• subRequest: SubscriptionRequest
Defined in
packages/core/src/fhircast/index.ts:414
Methods
dispatchEvent
▸ dispatchEvent<TEventType
>(event
): void
Type parameters
Name | Type |
---|---|
TEventType | extends "message" | "connect" | "disconnect" |
Parameters
Name | Type |
---|---|
event | FhircastSubscriptionEventMap [TEventType ] |
Returns
void
Inherited from
TypedEventTarget.dispatchEvent
Defined in
packages/core/src/eventtarget.ts:53
addEventListener
▸ addEventListener<TEventType
>(type
, handler
): void
Type parameters
Name | Type |
---|---|
TEventType | extends "message" | "connect" | "disconnect" |
Parameters
Name | Type |
---|---|
type | TEventType |
handler | (event : FhircastSubscriptionEventMap [TEventType ]) => void |
Returns
void
Inherited from
TypedEventTarget.addEventListener
Defined in
packages/core/src/eventtarget.ts:57
removeEventListener
▸ removeEventListener<TEventType
>(type
, handler
): void
Type parameters
Name | Type |
---|---|
TEventType | extends "message" | "connect" | "disconnect" |
Parameters
Name | Type |
---|---|
type | TEventType |
handler | (event : FhircastSubscriptionEventMap [TEventType ]) => void |
Returns
void
Inherited from
TypedEventTarget.removeEventListener
Defined in
packages/core/src/eventtarget.ts:64
disconnect
▸ disconnect(): void
Returns
void
Defined in
packages/core/src/fhircast/index.ts:460