local p=require((game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")).Test.Knit)local M=p.CreateService({Name="\077\121\083\101\114\118\105\099\101";Client={TestEvent=p.CreateSignal();TestProperty=p.CreateProperty("\072\101\108\108\111")};Middleware={Inbound={function(p,M)print("\077\121\083\101\114\118\105\099\101 \073\110\098\111\117\110\100",p,M)return true end},Outbound={function(p,M)print("\077\121\083\101\114\118\105\099\101 \079\117\116\098\111\117\110\100",p,M)return true end}}})function M.KnitInit(p)p.Client.TestEvent:Connect(function(M,R)print("\071\111\116 \109\101\115\115\097\103\101 \102\114\111\109 \099\108\105\101\110\116 \101\118\101\110\116\058",M,R)p.Client.TestEvent:Fire(M,R:lower())end)end function M.Client.TestMethod(R,p,M)print("\084\101\115\116\077\101\116\104\111\100 \102\114\111\109 \099\108\105\101\110\116\058",p,M)return M:upper()end;((p.Start({Middleware={Inbound={function(p,...)print("\073\078\066\079\085\078\068",p,...)return true end};Outbound={function(p,...)print("\079\085\084\066\079\085\078\068",p,...)return true end}}})):andThen(function()print("\075\110\105\116\083\101\114\118\101\114 \115\116\097\114\116\101\100")end)):catch(warn)
local Knit = require(game:GetService("ReplicatedStorage").Test.Knit)

local MyService = Knit.CreateService({
	Name = "MyService",
	Client = {
		TestEvent = Knit.CreateSignal(),
		TestProperty = Knit.CreateProperty("Hello"),
	},
	Middleware = {
		Inbound = {
			function(player, args)
				print("MyService Inbound", player, args)
				return true
			end,
		},
		Outbound = {
			function(player, args)
				print("MyService Outbound", player, args)
				return true
			end,
		},
	},
})

function MyService:KnitInit()
	self.Client.TestEvent:Connect(function(player, msg)
		print("Got message from client event:", player, msg)
		self.Client.TestEvent:Fire(player, msg:lower())
	end)
end

function MyService.Client:TestMethod(player, msg)
	print("TestMethod from client:", player, msg)
	return msg:upper()
end

Knit.Start({
	Middleware = {
		Inbound = {
			function(player, ...)
				print("INBOUND", player, ...)
				return true
			end,
		},
		Outbound = {
			function(player, ...)
				print("OUTBOUND", player, ...)
				return true
			end,
		},
	},
})
	:andThen(function()
		print("KnitServer started")
	end)
	:catch(warn)
