I will be transitioning a current use of react-use-websocket from communicating via json to communicating via msgpack, which requires sending raw bytes rather than strings.
I read the documentation online for this package, and saw that sendMessage(message, keep) expects message to be of type string.
So, I started to write this issue to request advice on whether it was safe to get around that by accessing the underlying websocket instance instead, or if a wrapper could be implemented.
Then, when looking in the actual source code, I realized that sendMessage actually expects message to be a WebSocketMessage, which can be an ArrayBuffer (which obviously works).
So this is a very small issue, but the documentation should be updated to reflect this.
I will be transitioning a current use of react-use-websocket from communicating via json to communicating via msgpack, which requires sending raw bytes rather than strings.
I read the documentation online for this package, and saw that sendMessage(message, keep) expects message to be of type string.
So, I started to write this issue to request advice on whether it was safe to get around that by accessing the underlying websocket instance instead, or if a wrapper could be implemented.
Then, when looking in the actual source code, I realized that sendMessage actually expects message to be a WebSocketMessage, which can be an ArrayBuffer (which obviously works).
So this is a very small issue, but the documentation should be updated to reflect this.