Skip to main content

porla_sockets

Allows plugins to work with sockets.

Exports

tcp_client(): PoTcpClient

Constructs a new TCP client that can be used to talk TCP.

Example

local sockets = require("porla_sockets")

local client = sockets.tcp_client()

client:connect("irc.libera.chat", 6697, function(err)
if err then
print("Failed to connect to irc.libera.chat: {}", err)
return
end

client:tls(function(err)
if err then
print("Failed to upgrade connection to TLS: {}", err)
return
end

-- begin read
end)
end)