Closed AntonPetrochenko closed 3 years ago
making a WebSocket server folds back into low level operations and server-blocking i/o.
howso?
Reading/writing from a websocket has it's own api, but it's different in terms of "server blocking i/o" than other request handling.
To accept a WebSocket connection I have to cobble together a socket on my own, and then implement my own cqueues loop to have it accept frames at all. Perhaps not just lua-http, but lua in general is not what I need for my use case. Can't even get a list of clients, have to make one myself.
The same stands for TLS. As soon as any TLS is involved, which in 2021 is synonymous with "any HTTP", you need to speak luaossl and https on your own. You could honestly remove luaossl from dependencies, given you have to attach it yourself manually anyway. http.tls
is a helpful set of helpers and constants, but it doesn't even take in anything from the rest of the library - it's just there to help you set up TLS with manual stream manipulation.
I wouldn't call implementing the entire HTTPS handshake "high level", unless there's something undocumented that I'm missing
attach it yourself manually anyway
??
lua-http handles tls for you.
e.g. client side, if you provide a url that's https
, then it will use TLS; likewise if a http url redirects to a https one.
server side, by default lua-http listens for both TLS and non TLS connections.
Apologies, I missed that part in the documentation. I'm tasked with making lua talk websocket and the deadline is "asap", not like I can pay much attention
Closing as there is no issue to solve here
Apologies, I missed that part in the documentation. I'm tasked with making lua talk websocket and the deadline is "asap", not like I can pay much attention
I have a crappy lua-http example apps here:
https://github.com/RussellHaley/lua-http-endpoints https://github.com/RussellHaley/we-client https://github.com/RussellHaley/Lua-WeGateway
This one is kindof neat. It combines cqueues with websockets and pttys: https://github.com/RussellHaley/minecraft-runner
This straight up doesn't stand true for many use cases, and WebSocket is one of them. Compared to the rest of the library, making a WebSocket server folds back into low level operations and server-blocking i/o.