[quickjs-devel] Re: tcp/udp sockets

  • From: guest271314 <guest271314@xxxxxxxxx>
  • To: quickjs-devel@xxxxxxxxxxxxx
  • Date: Sun, 19 Mar 2023 07:55:09 -0700

git submodule add -b v4.3-stable
https://github.com/warmcat/libwebsockets.git libwebsockets
fatal: A git directory for 'libwebsockets' is found locally with remote(s):
  origin https://github.com/warmcat/libwebsockets.git
If you want to reuse this local git directory instead of cloning again from
  https://github.com/warmcat/libwebsockets.git
use the '--force' option. If the local git directory is not the correct repo

On Sat, Mar 18, 2023 at 8:06 PM Roman Senn <roman.l.senn@xxxxxxxxx> wrote:

weird that this is happening..
force reinit it anew, using:

git submodule deinit -f libwebsockets
git rm -rf libwebsockets
git submodule add -b v4.3-stable
https://github.com/warmcat/libwebsockets.git libwebsockets

On Sat, Mar 18, 2023 at 1:56 AM guest271314 <guest271314@xxxxxxxxx> wrote:

$ git submodule update --init
Submodule 'libwebsockets' (https://github.com/warmcat/libwebsockets.git)
registered for path 'libwebsockets'
Cloning into '/home/user/qjs-net/libwebsockets'...
fatal: remote error: upload-pack: not our ref
f3c98d435f4ea475e0f375d77affa7dbebc28866
fatal: Fetched in submodule path 'libwebsockets', but it did not contain
f3c98d435f4ea475e0f375d77affa7dbebc28866. Direct fetching of that commit
failed.
fatal:

On Fri, Mar 17, 2023 at 2:53 PM Roman Senn <roman.l.senn@xxxxxxxxx>
wrote:

Hello guest271314,

Good news: since the last time I responded, I added some alternative
build systems which are much simpler.
(Also updated the README accordingly:
https://github.com/rsenn/qjs-net/blob/main/README.md)

One using "premake", use this command in the qjs-net folder:
premake5 gmake
or
premake4 gmake

The other is using "ninja" build tool:

ninja -C build

Both of them will expect a prebuilt libwebsockets installed in
/opt/libwebsockets
Build it using the "build-libwebsockets.sh" shell script:

. build-libwebsockets.sh
TYPE=Release builddir=libwebsockets/build build_libwebsockets
make -C libwebsockets/build/x86_64-linux-gnu  install

(libwebsockets is checked out as a git submodule of qjs-net if you issue
this command: git submodule update --init)

It may fail if your openssl/libressl doesn't have the functions
HMAC_CTX_new(), EVP_MD_CTX_free().
If this is the case, compile libressl 3.5.x or openssl-3.x.x from source
(libressl recommended)

CFLAGS="-g -O2 -w -fPIC" ./Configure --prefix=/opt/${PWD##*/}
--openssldir=/etc/ssl linux
make
sudo make install

(the ${PWD##*/} names the install prefix according to the source
directory, e.g. /opt/libressl-3.5.1)

If you want to try it I can assist you!

I did mange to compile minnet-quickjs. minnet-quickjs WebSocket server
hangs when piping through std.popen() and calling send(), onClose is not
called when WebSocketStream writable.writer close() or abrt() are called.
Did you make substantial changes to your fork of minnet-quickjs and run
stress tests which pipe a stream through to client from server.


Yes, qjs-net has substantial changes over minnet-quickjs.
In particular:
- how it uses libwebsockets went from blocking - a call to
minnet.server() blocks the QuickJS mainloop, js_std_loop for as long as the
HTTP server is serviced - rendering all async functions and timers defunct.
in qjs-net I use libwebsockets LWS_WITH_EXTERNAL_POLL feature, so quickjs
will do the I/O multiplexing using os.setReadHandler
- the CMake system is overly bloated, because it includes "external
subprojects" for compiling libressl & libwebsockets, because I rely on
features in them which aren't enabled in the packages that come with Linux
distributions.


Regards,
Roman



Other related posts: