import{_ as s,o as a,c as n,Q as e}from"./chunks/framework.419948d5.js";const u=JSON.parse('{"title":"Client","description":"","frontmatter":{},"headers":[],"relativePath":"api/1.0/client.md","filePath":"api/1.0/client.md"}'),l={name:"api/1.0/client.md"},o=e(`
A Client-sided Connection
.new Create new FastNet2 event
(
Identifier: string
)(
Identifier: string
)Identifier will converte/encode into hash identifier
local Remote = FastNet2.new("Remote")local Remote = FastNet2.new("Remote"):Connect or :Listen Listen an event from the server to receive, :Connect and :Listen is the same function.
(
callback: (...any) -> ()
)(
callback: (...any) -> ()
)Each event only allowed have one callback.
Remote:Connect(function(...)
print(...)
end)Remote:Connect(function(...)
print(...)
end)to know if the event is connected or not by doing .Connected
print(Remote.Connected)print(Remote.Connected):Disconnect Disconnect the event
Remote:Disconnect()Remote:Disconnect():Fire Fire the event to the server with data.
(
...: any
)(
...: any
)Remote:Fire("Hello World!")Remote:Fire("Hello World!")WARNING
This function have rate limiting to prevent spamming
:Pull Pull is a function that invoke to server.
(
timeout: number,
...: any
) -> (...any)(
timeout: number,
...: any
) -> (...any)local Request = Remote:Pull(2, "Hello World!")local Request = Remote:Pull(2, "Hello World!")WARNING
This function is yielded, and the minimum for timeout is 2 (seconds)
:Wait Wait the event that triggered/pinged
Remote:Wait()Remote:Wait()WARNING
This function is yielded
:Destroy Disconnect the event and Remove the event from FastNet2
Remote:Destroy()Remote:Destroy()