Category Archives: javascript

Server Sent Events using Laravel and Vue

Recently I was working on a new project, where I had to stream stock data and display it on a chart. My first instinct was to setup a loop using setTimeout, but I quickly realized that wouldn’t work for my exact needs. Stock prices change so frequently, often happening several times a second. Doing an ajax call every second seemed like the worst overhead baggage I could possibly program myself into. After doing a bit of research, I stumbled upon Server-Sent Events.  Continue Reading

setInterval is Bad

I got another reminder today of how bad setInterval can be. You just don’t hear developers talking about the problems with setInterval. In fact, I’ve seen numerous tutorials where good developers are using it in their examples. We need to start addressing this and start talking about the problems with setInterval. Continue Reading