How to print a non-stop stream of strings

I’m developing a progressive web-app at work.

One functionality I’m not sure how to do, is to send a nonstop stream of strings to a printer to be printed out in real-time.

Once a user logs an entry in the database, that needs to be sent to a printer to be printed out automatically.

The application is used for logging entry and exit times of trailers.

Would this be something I could achieve with websockets?

Ooh can you get a dot matrix printer that works and a box of perforated paper? I mean box, they probably don’t come in rolls.

1 Like

Those are still a thing?

That is what I am wondering. I guess someone still makes em. But theyd be pefect, if you had some drivers and just needed to post a string to them.

Thanks for the suggestion, I’ll definitely look into those.

They are called impact printers it seems. Epson still makes them.

eg:
https://epson.com/For-Work/Printers/Impact/LX-350-Impact-Printer/p/C11CC24001

That’s neat. Ideally, I want this to work with linux.

I want to have a small thing like an arduino or pi that listens on a socket and have this connected to the printer 24/7.

So if someone using the web app logs an entry it gets the timestamp and specific numbers and sends it over to the device to be printed. I don’t want to have to have every user connected to this printer.

1 Like

Yeah totally, would be a fun project. You might not need a printer as fancy as the one i linked.
Have a good trawl through youtube and the interwebs. Someone must be doing it somewhere.

1 Like


Works for youtube comments…
2 Likes

10 print "Strings"
20 goto 10
enter

Not sure if you’re just doing this for fun, if so that’s a neat project, but if you’re doing this for any type of real log retention that’s not an ideal setup.

Those are the required features that I have to work with lol.

As far as log retention goes, they need to maintain records for 5 years, both digital and paper. I can do the digital no problem, it was the paper one that was tripping me up.

Right now there is no digital, everything is handwritten when a truck comes in. My project is to alleviate the physical burden of having to do so and automating the process a bit. They still have to enter stuff into a form but its more straight forward and pre-populates with common data so it will speed up the process.

1 Like

Haha, funny.

I wish it were that simple :upside_down_face:

1 Like

Hmm. What type of digital logs are you keeping? How are they formatted? Could you just print those logs programmatically each day at a printer that’s located by the person that keeps the paper logs?

Edit: To be clear I have absolutely no solution to your original issue, just trying to think of solutions to your problem as a whole.

I’m storing my logs as embedded data in a mongo database. Mostly just stuff off of a checklist. Trailer numbers, going-to/coming-from, who recorded the log, what time (ISO 8601 format), etc. Stuff like that.

I’ll be able to show you when I get home. Mostly as strings, but some are numbers.

Unfortunately no, they need to be printed, as soon as the document is inserted into the collection. It’s their policy. I brought this option up actually, but they refused.

1 Like

Your people are stupid and should feel bad. Whatever you end up building, I’m sure there’s a market for it and you could probably sell it.

1 Like

Oh don’t worry, I’m going to license it under MIT and then hard fork a libre copy when I’m done.

And remove all the branding of course.

1 Like

How about writing a small service that connects to your database and monitors it for insertions and when a new record is written it reads the data and sends it to the printer?

I’m not familiar with MongoDB but in the past I’ve used ‘triggers’ with Oracle and SQL Server databases to perform work when data is modified.

A quick Google to see if there was something similar in MongoDB and I found something called “tailable cursors” cursors" which seem pretty cool. According to the docs they work very much like the “tail -f” unix/linux command.

If that’s the case could you have the service grab a cursor of all non printed records (when the entry is created it would have a flag set to indicate that it’s new and not yet printed).

When the service starts it would first print any records that have yet to be printed (as a catch up in case it was stopped for some time previously) , and print each one (updating the printed flag for each record as it goes) and then, as far as I can see, the code sits in a loop blocked on the tailed cursor which would wake when a new record is written that needs to be printed. The new record would then be printed, its printed flag updated and the code would go back to blocking on the tailed cursor.

You could do the same thing by just polling the DB for non printed records, but those tailed cursors (if they work how I think they might) seem like a better solution.

Anyway, just some ideas.

Shecks

1 Like

dot matrix printers? absolutely, they’re still very common in some industries.