WebSockets

WebSockets
Login

WebSockets

WebSockets and Node JS

Many examples/tutorials are based on NodeJS.

Node JS on MSYS2

nodejs/npm MSYS2 packages are outdated:
https://stackoverflow.com/questions/46473196/installing-nodejs-and-npm-on-msys2

Workaround: Download for MS Windows from https://nodejs.org/en/:

Add to path, or enable the following line to C:\msys64\msys2.ini:

    MSYS2_PATH_TYPE=inherit

Close any open MSYS2 windows, start a new shell and check:

    $ which node
    /c/Program Files/nodejs/node

    $ which npm
    /c/Program Files/nodejs/npm

Example 1

Start server:

    node server01.js

Check from client:

client01.html

    node server02.js

client02.html

Lighweight alternative to websockets: SSE (Server-Sent Events)

https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events

Example:
https://github.com/mdn/dom-examples/tree/master/server-sent-events

Links