Class WebSocketMessageService
public class WebSocketMessageService : IClientMessageService
- Inheritance
-
WebSocketMessageService
- Implements
- Inherited Members
- Extension Methods
Constructors
WebSocketMessageService(Lazy<IPatientService>, Lazy<IObservationService>, Lazy<IPumpService>, Lazy<ITreatmentService>, IGroupedObservationService, IConfigObservationService, Lazy<IAppointmentService>, IRelayService, IOptions<ApiSettings>, IOptions<RecordingSettings>, Lazy<IRecordingService>, IHubContext<UciHub>, Lazy<ILightBeaconService>, Lazy<IDiagnosisService>, Lazy<IAlarmService>, ISubscribersService, ISubscriberGroupedService, Lazy<IDisplayService>, Lazy<IUnitService>, Lazy<IAdmissionService>, Lazy<IDischargeService>, Lazy<INoticeService>, IObservationDemoService)
public WebSocketMessageService(Lazy<IPatientService> patientService, Lazy<IObservationService> observationService, Lazy<IPumpService> pumpService, Lazy<ITreatmentService> treatmentService, IGroupedObservationService groupedObservationService, IConfigObservationService configObservationService, Lazy<IAppointmentService> appointmentService, IRelayService relayService, IOptions<ApiSettings> apiSettings, IOptions<RecordingSettings> recordingSettings, Lazy<IRecordingService> recordingService, IHubContext<UciHub> hub, Lazy<ILightBeaconService> lightBeaconService, Lazy<IDiagnosisService> diagnosisService, Lazy<IAlarmService> alarmService, ISubscribersService subscribersService, ISubscriberGroupedService subscriberGroupedService, Lazy<IDisplayService> displayService, Lazy<IUnitService> unitService, Lazy<IAdmissionService> admissionService, Lazy<IDischargeService> dischargeService, Lazy<INoticeService> noticeService, IObservationDemoService observationDemoService)
Parameters
patientServiceLazy<IPatientService>observationServiceLazy<IObservationService>pumpServiceLazy<IPumpService>treatmentServiceLazy<ITreatmentService>groupedObservationServiceIGroupedObservationServiceconfigObservationServiceIConfigObservationServiceappointmentServiceLazy<IAppointmentService>relayServiceIRelayServiceapiSettingsIOptions<ApiSettings>recordingSettingsIOptions<RecordingSettings>recordingServiceLazy<IRecordingService>hubIHubContext<UciHub>lightBeaconServiceLazy<ILightBeaconService>diagnosisServiceLazy<IDiagnosisService>alarmServiceLazy<IAlarmService>subscribersServiceISubscribersServicesubscriberGroupedServiceISubscriberGroupedServicedisplayServiceLazy<IDisplayService>unitServiceLazy<IUnitService>admissionServiceLazy<IAdmissionService>dischargeServiceLazy<IDischargeService>noticeServiceLazy<INoticeService>observationDemoServiceIObservationDemoService
Methods
ProcessMessage(Message, string)
Processes an incoming message by routing it to the appropriate handler based on the subscription type. Handles ChatMessage, RecordingSuscribe, PatientData, GroupedObservations, Admin, Display, BoxSubscribe, Demo, and Idle operations.
public Task ProcessMessage(Message msg, string connectionId)
Parameters
msgMessageThe message to process, containing the operation type and payload.
connectionIdstringThe identifier of the connection that originated the message.
Returns
SendAsync(string, OperationType?, object?)
Asynchronously serializes the provided message to JSON using camelCase property naming and string-based enum conversion, then delivers it to the SignalR client identified by subscriberId via the "ReceiveMessage" event.
public Task SendAsync(string subscriberId, OperationType? type, object? msg)
Parameters
subscriberIdstringThe identifier of the SignalR client connection that should receive the message.
typeOperationType?The optional operation type associated with the message, included in the payload as its string representation when present.
msgobjectThe message object to serialize and send. May be
null.
Returns
SendToAllAsync(OperationType, object?)
Asynchronously broadcasts a message of the specified operation type to all connected SignalR clients, serializing the payload using camelCase JSON with ISO date formatting, suppression of null and default values, and roundtrip DateTime kind preservation.
public Task SendToAllAsync(OperationType type, object? msg)
Parameters
typeOperationTypeThe operation type that identifies the kind of message being broadcast.
msgobjectThe message payload to serialize and send. Can be null.
Returns
SendUpdateMessageToBoxes(List<PatientLocation>)
Sends an update message to all subscribers associated with the given patient locations. If the location has no bed specified, subscribers are matched by section; otherwise, subscribers are matched by both box (bed) and section.
public void SendUpdateMessageToBoxes(List<PatientLocation> patientLocations)
Parameters
patientLocationsList<PatientLocation>The list of patient locations used to determine which subscribers should receive the update message.