TelluIoT / ThingML

The ThingML modelling language
https://github.com/TelluIoT/ThingML
Apache License 2.0
101 stars 32 forks source link

libwebsocket 1.6+ compatibility for WebSocket POSIX plugin #239

Closed piernov closed 5 years ago

piernov commented 5 years ago

Add compatibility with libwebsocket 1.6+ (seems working with 3.0.0). API was modified between 1.5 and 1.6, some libwebsocket_ calls were renamed to lws_. 1.6 also introduced LWS_LIBRARY_VERSION_NUMBER so it is sufficient to check if it is defined to know if we are using 1.6. Any modern distribution should be on 2.0 or newer.

brice-morin commented 5 years ago

@ffleurey or @jakhog can you check this pull request? I would assume it is OK, but you know better the POSIX compilers and protocols.

ffleurey commented 5 years ago

Hello!

Thanks for your contribution, it looks good to me.

One question: I have not looked into the details but I see that you have made changes to templates which are in "compilers/c/src/main/resources/ctemplates/network_lib/". In general, we are trying to not have any template there and rather have them in "compilers/official-network-plugins/src/main/resources/templates" like some of the others which you have modified. Are you sure that the templates which are in "compilers/c/src/main/resources/ctemplates/network_lib/" are actually used? If they are not we should delete them. If they are we should move them to the "official-network-plugins" project. (I can do it after merging the pool request).

Also, as you probably have noticed, we are a bit short in ThingML samples and especially when it comes to the network plugins. If you have some simple examples that you can share using the websocket plugin, it is very welcome. We can put it together with other samples or if you make a repo yourself we can link to it.

piernov commented 5 years ago

About compilers/c/src/main/resources/ctemplates/network_lib it seems it is not used (still referenced in compilers/c/src/main/java/org/thingml/compilers/c/CCompilerContext.java though). I found those files doing a grep -r libwebsocket so I edited them as well. I updated the PR to delete those.

About the ThingML examples I don't have any, I was just trying to play with websockets. The one in org.thingml.samples/src/main/thingml/network/_posix/ws/WSPingPongSrv.thingml seems working at least.

ffleurey commented 5 years ago

Merged, Thanks!