websocket.close

From ComputerCraft
Jump to: navigation, search

websocket.close
Function
Syntax
websocket.close()
API http
Source CC:Tweaked (source)

Closes this websocket handle. You should always do this after finishing using a websocket, in order to free up resources.

ExampleExampleClose a websocket
Opens a websocket and then immediately closes it.
Code
local ws, err = http.websocket("wss://echo.websocket.org")
if ws then
  -- Probably should do something interesting with the websocket before
  ws.close()
end