websockets with express on nodejs

Does anyone have a very simple 'express' implementation/template/fragment collection lying around? (login,get (react to event), post(reply to tracker))?

I am a big boy and can and not too lazy to invest the time to find out myself what those basic steps are, but if someone else went already through the pain digging around, experiencing the fun of debugging, I would appreciate if they shared their insights.

I don't want to reinvent the wheel. Not out of laziness, but since those first steps are for everyone the same and there is IMHO no need for each and everyone to go through those same mundane, but incredibly time-consuming and sometimes painful steps again and again.

(There is for example certainly a way to build an app for each tracker but we all enjoy the TracCar app saving us from those countless pitfalls that the author already went through.) I am looking for a one level higher abstraction layer and if it does not exist yet, I will go through the moves and put that basic framework out to GitHub when complete. For those others who come later and can hit the ground running.

We all need to

  1. log in,
  2. receive events/data and
  3. react to them.

Right?

The fun comes after this (always same) framework is established and everyone can go from then on following their own creative path.

Closing: Any fragment helping to overcome the steep beginner's learning curve would be great.

Thank you in advance
gs

Anton Tananaev6 years ago

You can check simple web app code:

https://github.com/traccar/traccar-web/blob/master/web/simple/app.js

It's not NodeJS, but should give you an idea how to do it.