Skip to content
WebSocketOverview

WebSocket.send

Represents sending a message on a WebSocket connection.

AliasesWebSocket.Send

Details#

Sends a string through an established WebSocket object using socket:Send. This is an object method, not a second connection operation; sending after closure can fail.

Examples#

Example

Luau
local ok, socket = pcall(WebSocket.connect, "ws://127.0.0.1:8081")
if ok then
    socket:Send("local echo")
    socket:Close()
else
    warn(socket)
end