Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Moving away from libwebsockets

----- Original Message -----
> From: "Roger Light" <roger@xxxxxxxxxx>
> To: "Wiebe Cazemier" <wiebe@xxxxxxxxxxxx>
> Cc: "General development discussions for the mosquitto project" <mosquitto-dev@xxxxxxxxxxx>
> Sent: Wednesday, 3 February, 2021 17:30:14
> Subject: Re: [mosquitto-dev] Moving away from libwebsockets

> On Wed, 3 Feb 2021 at 15:46, Wiebe Cazemier <wiebe@xxxxxxxxxxxx> wrote:
>> > I am currently looking at using the picohttpparser and wslay libraries
>> to provide websockets support.
>> Just for brainstorming: do websockets really need much special? How wild is it
>> to split input stream on newlines and wait for the upgrade header and then
>> generate/parse websocket frames? There would have to be some protection, like
>> not allowing more than x bytes before the upgrade and such, but perhaps it's an
>> option? It saves having dependencies.
> Sure, there's not a huge amount to it. There are some oddities with
> wslay that I'm not entirely happy with that may well make it worth
> implementing ourselves. The http header part though - I'm not sure
> it's worth the effort. picohttpparser is about 600 lines, it's not
> exactly a big dependency. As it's not packaged anywhere, I'd
> anticipate bundling it in the tar. wslay on the other hand is quite
> widely available.
> The change to use picohttpparser and wslay wasn't a lot of effort. It
> lays the groundwork for moving to our own implementation if we want -
> it integrates much better than lws. Importantly though, it's available
> now. The default lws settings now disable their external poll support,
> and we rely on that working properly in 2.0. That means that
> websockets support for 2.0 won't work on the Debian lws packages for
> example:
> We've always used the external poll support, but in a way that meant
> it wasn't crucial if it was disabled.
> tldr: I'd be happy to entertain our own websockets (but probably not
> http parser) implementation, but wslay gives a quick win for now for
> most situations.
> Regards,
> Roger

BTW, you may also want to keep HTTP2 in mind. Parsing is harder, because of the multiple streams.



Back to the top