WebSocket
A persistent WebSocket client for real-time bidirectional communication.
function WebSocket.connect(url: string): WebSocketSynopsis
How it works
Establishes a WebSocketWebSocketA full-duplex communication protocol over a single TCP connection (RFC 6455). Unlike HTTP request-response, WebSockets maintain a persistent bidirectional channel. URLs use ws:// or wss:// (TLS-encrypted) schemes. connection to the specified URL, bypassing Roblox’s network restrictions. Uses the system’s HTTP stack to perform the WebSocket handshake and upgrade. Returns a WebSocket object with
:Send(data), :Close(), and .OnMessage / .OnClose event callbacks.Use case
Real-time bidirectional communication with external servers — useful for remote control panels, live data feeds, multiplayer bot coordination, or webhook-based logging. The connection persists until explicitly closed or the script ends. Supports both
ws:// and wss:// (TLSTLSTransport Layer Security — the cryptographic protocol that secures HTTPS connections. Encrypts data in transit between client and server. On Windows, the Schannel provider handles TLS negotiation.) protocols.Usage
Echo server round-trip
local ws = WebSocket.connect("wss://ws.postman-echo.com/raw")
ws.OnMessage:Connect(function(msg)
print("Server replied:", msg)
end)
ws.OnClose:Connect(function()
print("WebSocket closed")
end)
ws:Send("Hello from Vindicta!")
"cc">-- Server echoes back: Hello from Vindicta!Close after receiving one message
local ws = WebSocket.connect("wss://ws.postman-echo.com/raw")
ws.OnMessage:Connect(function(msg)
print("Got:", msg)
ws:Close()
end)
ws:Send("ping")Parameters
url string A valid WebSocket server URL starting with ws:// or wss://.
Returns
WebSocket A connected WebSocket object. Members: Send(msg), Close(), OnMessage: RBXScriptSignal, OnClose: RBXScriptSignal.
Client only
This is a WebSocket client API. You cannot host a server from within a Roblox exploit script.
Methods & Events
ws:Send(message: string) — send a text message. ws:Close() — terminate the connection. ws.OnMessage — fires when a message is received. ws.OnClose — fires when the connection closes.