Closed stephenkgu closed 5 years ago
Here was my first attempt. It's a websocket server and a client. I haven't run this in a long time so I don't remember if it works or not: https://github.com/RussellHaley/lua-http-endpoints
Here is a cqueues application that runs minecraft in a pty and then serves out the console output via a (lua-http) websocket: https://github.com/RussellHaley/minecraft-runner
Here is the same codebase as the minecraft-runner project only with the minecraft stuff stripped out: https://github.com/RussellHaley/we-client
Caveat emptor...
an example for websocket server, anyone gives one like server_hello?
In your on_stream
callback (after doing any logging/routing/etc you feel like) you would write:
local ws = assert(websocket.new_from_stream(stream, headers))
assert(ws:accept()) -- can be passed options for advanced use cases.
and then just use ws:send()
and ws:receive()
cannot find an example for websocket server, anyone gives one like server_hello?
thanks