HL7-3: remove optimistic updates #5

Merged
markus merged 3 commits from 3-remove-optimistic-updates into development 2025-07-30 11:16:43 +00:00
Showing only changes of commit a892cbba46 - Show all commits

View file

@ -39,7 +39,7 @@ const clients = new Map();
console.log(`Starting WebSocket server ...`);
console.log("Server configuration:", config);
console.log('Server configuration:', config);
wss.on('connection', (ws) => {
@ -105,17 +105,29 @@ wss.on('connection', (ws) => {
// check if recipient exists and is connected
if (recipientWs && recipientWs.readyState === WebSocket.OPEN) {
const timestamp = new Date().toISOString();
// The recipient is connected. Forward the message.
const forwardMessage = {
type: MessageType.receive_hl7v2,
payload: {
message: message,
timestamp: new Date().toISOString(),
timestamp: timestamp,
},
} as Message;
recipientWs.send(JSON.stringify(forwardMessage));
console.log(`Forwarded message to ${recipientId}`);
const ackMessage = {
type: MessageType.delivery_success,
payload: {
message: message,
timestamp: timestamp,
},
};
ws.send(JSON.stringify(ackMessage));
console.log(`Sent acknowledgment to ${stationId}`);
} else {
// The recipient is not connected or not found.