Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why would I want to use civetweb for WebSockets, if this exists? #83

Open
mavavilj opened this issue Dec 2, 2023 · 5 comments
Open
Labels

Comments

@mavavilj
Copy link

mavavilj commented Dec 2, 2023

I initially looked at using civetweb to run a WebSocket Server:

https://github.com/civetweb/civetweb

Then I found this library.

Now I am wondering, what point might civetweb have in comparison to this project. Civetweb seemed more popular, but this seems far simpler.

@mavavilj
Copy link
Author

mavavilj commented Dec 2, 2023

Oh, well at least the license is different (GPL vs MIT).

@Theldus
Copy link
Owner

Theldus commented Dec 3, 2023

Hi @mavavilj,
I have never used civetweb, so my observations below are based on what I could understand from the project (and src), so take my words with a grain of salt.

Apparently, civetweb seems to be an all-in-one solution for the web: in addition to WebSockets, it provides a web server that supports CGI, Lua scripts, and SSL (also for WebSocket).

Focusing solely on WebSocket, it seems to support:

  • Native SSL support (wsServer requires a proxy for this)
  • Deflate support (compression)
  • WebSocket extensions

From an implementation perspective, it looks quite similar to wsServer, with a thread-based approach, use of events, and so on.

In general, wsServer strives to be compliant only with RFC6455, while civet seems to aim for more universality. Still, regarding this, I haven't seen compliance tests with the standard in civet (like Autobahn), so I can't say how compliant it is1. For example, I noticed that the client's close is not 'clean' if the client do not send any message.

Which one should you use?
It depends on your requirements. If you:

  • Only need WebSocket
  • Don't need SSL or plan to use a proxy (like nginx, Stunnel...)
  • Want small and hackable code (2k LOC vs 20k LOC)

use wsServer.

Oh, well at least the license is different (GPL vs MIT).

As you also pointed out, there's also the licensing issue... MIT is more permissive than GPLv3... I really wanted to change the license of wsServer, but I need acknowledgment from all the committers/contributors to the project, so I haven't done it yet.

Footnotes

  1. I've decided to give a try and test civetweb on the Autobahn, adapting the 'ws_server.c' example to echo messages and... as expected, I encountered some failures, which can be seen in the attached file (see reports/civet/index.html).

@keifufu
Copy link

keifufu commented Dec 3, 2023

Is there a chance we could see the license of wsServer change to MIT soon?
I've been testing this library and love it due to its simplicity and would prefer it over all other libraries I've found so far, but I'm hesitant to license my own libraries/projects under GPLv3.

@Theldus
Copy link
Owner

Theldus commented Dec 3, 2023

Hi @keifufu,
The best I can do at the moment is to ask all existing contributors for their permission under the license change, which I did in issue #84.

However, it is highly likely that I will not receive an ack from everyone in a timely manner (or any ack at all...), so the best we can do now is wait =).

@keifufu
Copy link

keifufu commented Dec 3, 2023

I appreciate it. I will happily wait and see where this gets us!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants