Closed glenarama closed 7 months ago
Will look into! I am actually working on better error handling so I'll add this to the queue for checks.
Anything else in your code? Or Just that?
Thanks for looking at this:
Anything else in your code? Or Just that?
Just the import - full index.ts file:
import { Client } from "node-hl7-client";
try {
const client = new Client({ host: "xx.xx.xx.xx" });
client.createOutbound({ port: xxxxx }, async () => {});
} catch (err) {
console.log("Error", err);
}
Roger. I just ran it @ work real quick. Yep. An error. sigh. Ok will do a deep dive tonight.
@glenarama I think I narrowed down the issue. Just to make sure so I can test correctly,..
I am doing a test with Corepoint, and even though the port is open, etc. it's not connecting (more fun news), but with my node-hl7-server package it's working fine.
Am sending to a third party - it is a valid destination but i can't confirm if their server is responding correctly.
Ok. You and I are having the same issue then....
So two errors:
So.. more updates..
const {Client, Message} = require("node-hl7-client");
try {
const client = new Client({ host: 'x.x.x.x'})
const test = client.createOutbound({port: 19999 }, async (res) => {
const message = res.getMessage()
console.log(message.toString())
})
const message = new Message({
messageHeader: {
msh_9_1: "ADT",
msh_9_2: "A01",
msh_10: "1234567890",
msh_11_1: "D"
}
})
test.sendMessage(message)
test.close()
} catch (e) {
console.log(e)
}
When I did this and did a wireshark capture on my Corepoint server, I saw:
And Corepoint was processing it correctly (IB on corepoint is not set to send the ACK right now), but it did process it,
Maybe it's a design issue...
createOutbound
doesn't try to "connect" until sendMessage is done and then doing the "open" and "close" in that seqeuence making the code simpler (and breaking the API).
I am working on revising the structure so that sendMessage is the only thing being used. More than likely I will mark this breaking. I am not sure how many people are using this NPM package yet...
Almost got this corrected...
Great! Let me know if you'd like some testing on a version.
@glenarama I haven't commit the bulk changes even locally yet because I just want to make sure that I am tracking the changes. It will break a lot of the current API so I am being careful. I am checking all my other unit testing outside of this internal checking so it's a lot longer process. Tried to get it out this weekend, but just to much to look over. Needs to be perfect.
@glenarama the code is pushed. still trying to fix a linting issue, but my head to to tired for get to it tonight.
:tada: This issue has been resolved in version 2.0.0-beta.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
@glenarama Ok.. so release..
Here is a quick script:
const client = new Client({ host: 'x.x.x.x' })
const outbound = client.createConnection({ port: 19999 }, async (res) => {
const messageRes = res.getMessage()
console.log(messageRes.toString())
})
let message = new Message({
messageHeader: {
msh_9_1: 'ADT',
msh_9_2: 'A01',
msh_10: 'CONTROL_ID',
msh_11_1: 'D'
}
})
outbound.sendMessage(message)
that I been using as my test to a Corepoint server vs. my node-hl7-server package. I tested it out there too, but I have to update that package to work with this 2.0.0-beta.1 before fully committing this to main.
All my unit tests are messed up. Some how jest is not closing the port after I tell it too... sigh. Why do I even bother anymore..
:tada: This issue has been resolved in version 2.0.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I've managed to get a working connection with the new release Thankyou!. A couple of question i can't find documented or in the code:
Note this is a TLS connection:
try {
const client = new Client({host: "xx.xx.xx.xx", tls: { rejectUnauthorized: false }});
const outbound = client.createConnection({ port: xxxxx }, async (res) => {
const messageRes = res.getMessage();
console.log("msg: ", messageRes.toString());
},
);
let message = new Message({
messageHeader: {
msh_9_1: "ADT",
msh_9_2: "A01",
msh_10: "CONTROL_ID",
msh_11_1: "D",
},
});
outbound.sendMessage(message);
} catch (err) {
console.log("Error", err);
}
@glenarama A fix in 2.3.1 fixes this issue.
Thanks for the library!
Receiving an error on connection - any help appreciated: Version: node-hl7-client 1.1.3
Client creation seems fine, but outbound request throws: