[Libwebsockets] minimal-ws-client with foreign libevent loop
andy at warmcat.com
Wed Feb 10 00:34:24 CET 2021
On 2/9/21 9:54 PM, John Dunn wrote:
> On Tuesday, February 9, 2021 2:33 PM, Andy Green wrote:
>> Well, I appreciate your taking the time to explain to me that there's no
>> way lws can work.
> I apologize if my tone came across that way - it wasn't what I was intending to say. I was just trying to trace through the code to understand how things were supposed to work so I could understand where things were broken.
> I tried your code and got the same result as before. I'm guessing that means either it's an issue with my setup ( the most likely scenario ) or an issue with Windows. Can I ask what version of libevent are you using? I have 2.1.8-stable on my system.
It's Fedora 33's libevent-2.1.8-10.fc33.x86_64, ie, more or less the same.
The problem is specific to windows platform, it needs an extra htrimer
schedule at init to get it started... Linux doesn't need it.
I pushed a patch on main that adds that and cleans some types in the
minimal example that become warnings on windows.
Here's what I did after that to see the modified code I pushed work on
I downloaded libevent from git and built and installed it in its default
windows place. Then I configured lws
cmake .. -DLWS_WITH_LIBEVENT=1 -DLIBEVENT_INCLUDE_DIRS="C:\Program
Files (x86)\libevent\include" -DLIBEVENT_LIBRARIES="C:\Program Files
and built it
cmake --build . --config DEBUG
it built fine and I could run the eventlib-foreign example well.
copy "C:\Program Files (x86)\libevent\lib\*" .
I hacked the modified example to take the place of the existing
minimal-http-server-eventlibs-foreign and built it in-tree with lws.
After the patch to lws mentioned above it could work the same as on Linux.
More information about the Libwebsockets