Fine-grained heart rate data not available through garmin/fit-javascript-sdk for pool swim activities?

I am currently parsing pool swim activity FIT files through the official Javascript SDK (https://github.com/garmin/fit-javascript-sdk). I have been unable to find any way of extracting the fine-grained heart rate data that I can see on Garmin Connect. I can see are Time In Zone and Lap message entries with summarized HR data, but nothing that gives me the fine grained data points I see in the graph below (the graph below is what I see for the same FIT file I'm processing that I downloaded from my personal Garmin Connect account):

I don't have this issue w/ open water swims as those consist of Record messages that contain the heart rate (however, pool swims lack those message types).

Here is how I am initializing the decoder:

        let decoder = new Decoder(file_stream);
        const { messages, errors } = decoder.read({
            mesgListener: fit_message_stream_listener.get_stream_listener(),
            applyScaleAndOffset: true,
            expandSubFields: true,
            expandComponents: true,
            convertTypesToStrings: true,
            convertDateTimesToDates: true,
            includeUnknownData: true,
            mergeHeartRates: true
        });

Any suggestions on how I can get this data? Is this a current limitation of the JavaScript SDK? Any other recommended ways of extracting this data?

PS. I am using this logic in a Garmin sync endpoint for our product. I would ideally like to keep the solution within the JavaScript domain, but open to other options. Thank you! 

  • Never-mind. User error. My message listener was skipping over the records. In this case, the RECORD message type for pool swims contains the timestamp and heart rate.

  • With the JavaScript SDK you don't necessarily need to use a message listener. The record messages are returned as an array from the decoder. From your example code, the record messages would be at messages.recordMesgs, and the heart rate values at messages.recordMesgs[index]['heartRate'].

    You mentioned "pool swims", if the user is wearing an HRM the HR values will not be merged to the record messages until all the messages are decoded. There HR messages from the HRM are appended to the end of the file when the user saves the activity. So the HR values in the record messages may get updated after the message listener is called for a record message.