Imagine a scenario where you have a string consisting of ones and zeros, for example:
"0101101"
Now, the question arises - is there a way to transmit only these bits using the WebSocket.prototype.send method?
The first step would be to convert these bits into an ArrayBuffer. But how can this conversion be achieved?
Sending the string as it is won't work because each 1 and 0 would occupy 1 byte (due to being considered characters and UTF-8 encoded). So, the challenge lies in converting these string-bits into an ArrayBuffer before transmitting them.
It's worth noting that this inquiry is not about changing a bitstring into integer values; rather, it pertains to transforming it into an ArrayBuffer