WebSocket.sendMessage

auto sendMessage(WebSocketMessage message, bool flagFIN = true)

Send a custom message. flagFIN is true by default and should be true for most cases. You want to set it to false if you are sending a message in parts. The last part should have flagFIN set to true. The masked parameter is false by default and should be false for most cases. It is used if a message is sent from a client to a server.

Returns

false if the message is partially sent. The leftover data will be sent on the next sending cycle or using sendLeftover()

auto msg = WebSocketMessage(WebSocketMessage.OpCode.Text, "Hello world");
ws.sendMessage(msg);