Message builder
Creating a RESPONSE message
// Create the messageconst responseMessage = new Message(MessageType.RESPONSE, { id: "123", response: { status: 200, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: "Hello, world!" }), },});// Send the message on the WebSocket connectionws.send(responseMessage.toString()); Copy
// Create the messageconst responseMessage = new Message(MessageType.RESPONSE, { id: "123", response: { status: 200, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: "Hello, world!" }), },});// Send the message on the WebSocket connectionws.send(responseMessage.toString());
Optional
Readonly
Message builder
Example
Creating a RESPONSE message