method
bun.WebSocketHandler.message
): void | Promise<void>;
Called when the server receives a message.
If the message is not a string, its type is based on the value of binaryType.
- if
nodebuffer, then the message is aBuffer. - if
arraybuffer, then the message is anArrayBuffer. - if
uint8array, then the message is aUint8Array. - if
blob, then the message is aBlob.
The declared type of message is the one of the default binaryType.
@param ws
The websocket that sent the message
@param message
The message received
Referenced types
class ArrayBuffer
Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.