Potassium API
  • Environment
    • Cache
    • Closures
    • Console
    • Crypt
    • Debug
    • Drawing
    • File System
    • Input
    • Instance
    • Metatable
    • Miscellaneous
    • Scripts
    • Web Sockets
    • Actor
Powered by GitBook
On this page
  • WebSocket.connect
  • WebSocketConnection
  • Methods
  • Events
  1. Environment

Web Sockets

WebSocket.connect

<WebSocketConnection> WebSocket.connect(<string> url)

Establishes a WebSocket connection to the specified URL.

local ws = WebSocket.connect("ws://localhost:8080")

ws.OnMessage:Connect(function(message)
	print(message)
end)

ws.OnClose:Connect(function()
	print("Closed")
end)

ws:Send("Hello, World!")

WebSocketConnection

ws = WebSocket.connect(url)

Methods

Method
Description

Sends a message over the WebSocket connection

Closes the WebSocket connection

Events

Event
Description

Fired when a message is received over the WebSocket connection

Fired when the WebSocket connection is closed


PreviousScriptsNextActor

Last updated 2 months ago

Send(<string> message)
Close()
OnMessage(<string> message)
OnClose()