If you want to be able to trim off the ends, I suggest a double fisherman’s instead (aka the double overhand stopper) with both strands (hold them together while you tie and treat them as a single strand).
https://www.animatedknots.com/double-overhand-stopper-knot
With either knot, after you trim, you can melt the ends of the elastic cord. It will “mushroom” a bit, which will also prevent the tips from creeping into the knot and coming loose.
The simple answer is yes.
It’s possible to encode or tunnel anything over any protocol.
The next question is why isn’t it done more?
For the above reasons it’s actually more common to see other protocols run on top of http. This is especially common to prevent blocking and censorship by making the traffic look like normal http traffic when it may actually be private messaging apps, file transfers, VPN, etc.