Fix usage example & extend by example command response handler#14
Fix usage example & extend by example command response handler#14dexterbg wants to merge 3 commits intobirkir:masterfrom
Conversation
|
@dexterbg I was looking into this library, but I'm not able to use it with dexters-web server; is this due to no token authentication on this server? |
|
No, the library uses the MP API, not the REST API. It works perfectly with my server, so you probably have an error in your configuration. Maybe you tried connecting to the TLS port? That's not supported by this library yet. Your client creation should look like this: Regards, |
Edit:Just as I posted this comment, I got it working. I had to downgrade to node16 for some reason Original commentNo, the creation looks precisely like that (although I did try using TLS first).Just to keep it as simple as possible I tried this: client.on('connected', callback => {
console.log('Connected')
// Send a ping
// (see https://docs.openvehicles.com/en/latest/protocol_v2/messages.html)
client.sendRaw('MP-0 A');
});
// connect
client.connect(); // Tried with this both at the start and endBut 'Connected' never gets printed out - the process just terminates without any output. I've tried multiple listeners with the same result (essentially copied the example from this PR), and I get the same result: |
|
Dupe of #19 right? |
|
Yes, I took in these changes as well in #19 |
Birkir,
thanks for contributing this NodeJS client implementation, we didn't know about it until now, or we would have added a fork to the OVMS account earlier. Two guys, Gregg Hansen & Pablo Cabrera, are currently using your module to implement a react native app, you're welcome to join the discussion on the developer mailing list:
I found an error in your usage example, also receiving the command results wasn't clear for Gregg & Pablo, so this is the PR to fix that.
It would also be nice if the module would support TLS connections. Possibly Gregg & Pablo can take care of that.
Regards,
Michael