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(`

Client

A Client-sided Connection

.new

Create new FastNet2 event

lua
(
	Identifier: string
)
(
	Identifier: string
)

Identifier will converte/encode into hash identifier

lua
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.

lua
(
	callback: (...any) -> ()
)
(
	callback: (...any) -> ()
)

Each event only allowed have one callback.

lua
Remote:Connect(function(...)
	print(...)
end)
Remote:Connect(function(...)
	print(...)
end)

to know if the event is connected or not by doing .Connected

lua
print(Remote.Connected)
print(Remote.Connected)

:Disconnect

Disconnect the event

lua
Remote:Disconnect()
Remote:Disconnect()

:Fire

Fire the event to the server with data.

lua
(
	...: any
)
(
	...: any
)
lua
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.

lua
(
	timeout: number,
	...: any
) -> (...any)
(
	timeout: number,
	...: any
) -> (...any)
lua
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

lua
Remote:Wait()
Remote:Wait()

WARNING

This function is yielded

:Destroy

Disconnect the event and Remove the event from FastNet2

lua
Remote:Destroy()
Remote:Destroy()
`,34),p=[o];function t(c,r,i,d,y,E){return a(),n("div",null,p)}const g=s(l,[["render",t]]);export{u as __pageData,g as default};