import{_ as t,D as n,c as l,m as s,a as i,I as p,U as a,o as h}from"./chunks/framework.BouBWMxc.js";const B=JSON.parse('{"title":"Server","description":"","frontmatter":{},"headers":[],"relativePath":"api/1.0/server.md","filePath":"api/1.0/server.md"}'),k={name:"api/1.0/server.md"},d=a(`

Server

For Server-sided

.Server

Create new Warp event.

lua
(
	Identifier: string,
	rateLimit: {
		maxEntrance: number,
		interval: number,
	}?
)
lua
local Remote = Warp.new("Remote")

:Connect

Connect event to receive incoming from client way.

lua
(
	player: Player,
	callback: (...any) -> ()
): string
lua
Remote:Connect(function(player, ...)
	print(player, ...)
end)

:Once

This function likely :Connect but it disconnect the event once it fired.

lua
(
	player: Player,
	callback: (...any) -> ()
)
lua
Remote:Once(function(player, ...)
	print(player, ...)
end)

:Disconnect

Disconnect the event connection.

lua
(
	key: string
)
lua
local connection = Remote:Connect(function(player, ...) end) -- store the key

Remote:Disconnect(connection)

:DisconnectAll

Disconnect All the event connection.

lua
Remote:DisconnectAll()

:Fire

Fire the event to a client.

lua
(
	reliable: boolean,
    player: Player,
	...: any
)
lua
Remote:Fire(true, player, "Hello World!")
`,20),r={id:"fires",tabindex:"-1"},o=s("code",null,":Fires",-1),c=s("a",{class:"header-anchor",href:"#fires","aria-label":'Permalink to "`:Fires` "'},"​",-1),E=a(`

Fire the event to all clients.

lua
(
	reliable: boolean,
	...: any
)
lua
Remote:Fires(true, "Hello World!")

:Invoke

Semiliar to :InvokeClient, its for Invoke to a client.

lua
(
	timeout: number,
    player: Player,
	...: any
) -> (...any)
lua
local Request = Remote:Invoke(2, player, "Hello World!")

WARNING

This function is yielded, once it timeout it will return nil.

:Wait

Wait the event being triggered.

lua
Remote:Wait()

WARNING

This function is yielded, Invoke might also ping this one and also causing error.

:Destroy

Disconnect all connection of event and remove the event from Warp.

lua
Remote:Destroy()
`,13);function g(y,u,v,b,F,C){const e=n("Badge");return h(),l("div",null,[d,s("h2",r,[o,i(),p(e,{type:"tip",text:"Server Only"}),i(),c]),E])}const f=t(k,[["render",g]]);export{B as __pageData,f as default};