Sunday, December 2, 2018

Websockets!

Great library, impossible to install the cmake is 2,000 lines of code, and that is just to make the makefile.  I loaded a version of websockets using the RPM, installed it with the gnome gui tool, but yum nd dnf nor olocate an find any file that matches the websockets.org, because why? Multiple implementations. I loaded a version which has no c interface, it was java; but I am looking at a document describing a c interface.

So, 2,000 lines of cmake to make a makefile to compile about 1000 lines of c? I could make a simplewebsocket meeting the spec for certainly less than the 2,000 lines of script needed to place he result on a disk.

Nightmare of linux bloat. I looks like I will run the 2,000 lines of cmake, then makefile, then the probability of failure is nearly 50%, even though I have a clean linux version.

Websockets,  a basic and fundamental and simple interface between socket devices and messaging needs.  How in the frig sdid we end up with 2,000 lines of cmake for that? The socket and internet protocol is quite standard across computers.

I am in the lab looking at this bloat and considering whether it is better to throw some ad hoc socket  code into join somewhere.  My best bet, in a day I can be messaging to myself with linux sockets.  It is three days for me to sort out all the linux bloat surrounding websockets.  But I do not want to do the non-standard thing, so if I toss a few lines of experimental socket io in join, then I want the pro to look and see an upgrade path to true web sockets. A pro who understands why:

gcc -o libwebsocket websocket.c

becomes 2000 lines of cmake.

So I look at a simple socket example, 57 lines of code.  I cut and paste, save it, it compiles. I start python -m SimpleHTTPServer,
then run my sample socket code. Connects just fine.  57 lines of code, five minutes vs three hours to simply sort out the websockets market.  Why not just read the websocket specs (it is an ISO standard), then implement the two components I need, and let the pros worry the rest. I am in the lab, I do not hire expensive IT guys to sort the linux bloat.

So, since the websocket interface is an ISO standard, and it is simple (200 lines of code in c), then I can cutnpaste from the examples I found.  The server and client are both in one package because  joins are all connect peer to peer.  Each join will both listen for requests and send requests as needed.

No comments: