Skip to content

Instantly share code, notes, and snippets.

@cablehead
Last active May 21, 2016 22:24
Show Gist options
  • Save cablehead/d61474fa7a3f8b2ea00057c730b726ec to your computer and use it in GitHub Desktop.
Save cablehead/d61474fa7a3f8b2ea00057c730b726ec to your computer and use it in GitHub Desktop.
local levee = require("levee")
local p = levee.p
local h = levee.Hub()
local err, serve = h.stream:listen(9000)
for conn in serve do
h:spawn(function()
local stream = conn:stream()
while true do
local err, line = p.line.stream(stream, "\r\n")
if err then break end
conn:send(line.."\r\n")
end
conn:close()
end)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment