Hi guys,
is it possible to build a websocket server with pas2js and the node modules?
thanks
k1

Mailing lists / pas2js / 2023-10
7 messages · 3 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi guys,
is it possible to build a websocket server with pas2js and the node modules?
thanks
k1
Peter wroteHi guys, is it possible to build a websocket server with pas2js and the node modules?
Yes, it is.
Node does not have websockets built-in, so you may need to use a third-party library such as "ws" if you don't want to write the socket server from scratch.
We don't provide a unit that describes the ws library, but using dts2pas you should be able to create the unit, since there is a typescript module description available in the DefinitelyTyped repo.
See the following article, it describes how to go about it:
https://www.freepascal.org/~michael/articles/#typescript
If you need help, feel free to mail me.
Michael.
El 3/10/23 a les 16:21, Michael Van Canneyt via Pas2js ha escrit:
Wonderful, but I think that the lazarus integration is for the next version (I cannot see in in 2.2.6), the online service gives an error (the frontend, the url with full parameters works, as well as the one in the screen capture).
But how do I compile dts2pas?
I find a couple of dts2pas.pp in the checked out sources, but no Makefile references them (I see it's references in fpmake but I don't know how to use it).
$ find -name dts2pas*
./compiler/packages/fcl-js/examples/dts2pas.pp
./compiler/utils/pas2js/dts2pas.pp
$ grep -Ri dts2pas
packages/electron/libelectron.pas: Electron API description. Mostly
autogenerated using dts2pas
grep: .git/modules/compiler/index: binary file matches
compiler/packages/fcl-js/examples/.gitignore:dts2pas
compiler/packages/fcl-js/examples/dts2pas.pp:program dts2pas;
compiler/utils/pas2js/fpmake.pp: PT:=P.Targets.AddProgram('dts2pas.pp');
compiler/utils/pas2js/dts2pas.pp:program dts2pas;Bye
The lazarus integration indeed only exists in trunk.
You should use the latter one.
Just run make in compiler/utils/pas2js, and make will run fpmake and compile dts2pas.
Michael.
El 3/10/23 a les 17:57, Michael Van Canneyt via Pas2js ha escrit:
You should use the latter one. Just run make in compiler/utils/pas2js, and make will run fpmake and compile dts2pas.
$ make
/usr/local/bin/ppcx64 fpmake.pp -n -Fu../../rtl
-Fu../../packages/paszlib -Fu../../packages/fcl-process -Fu../../packages/hash -Fu../../packages/libtar
-Fu../../packages/fpmkunit -Fl/usr/lib/gcc/x86_64-linux-gnu/12 Fatal: Can't find unit system used by fpmake
Fatal: Compilation aborted
make: *** [Makefile:2804: fpmake] Error 1
Bye
Hm. It seems it does not detect your target platform, the unit paths are all wrong ?
Michael.
El 3/10/23 a les 23:35, Michael Van Canneyt via Pas2js ha escrit:
Well, it's the same compiler I used to build pas2js and the same pas2js I use to compile my pas2js projects (using lazarus).
Bye