Thanks for the sharing the examples, they look great! By default HiveMQ uses an MQTT connection over TC/IP with support for websockets as you have displayed in your examples. Out of the box HiveMQ does not offer a way to create MQTT connections via HTTPS requests but this is something that could be done with some customizations/effort on your end.
Out of curiosity against what kind of HiveMQ broker do you test against? The public broker broker.hivemq.com (has no secure listener), HiveMQ cloud (has secure listener) or your own setup?