Skip to main content

In the previous article we made a very simple app that sent updates to clients in real-time, and in this article, we’ll build on that example and make a slightly more complicated app; a private messaging app.

In the first example messages were broadcast to all client, but this time we’ll authenticate users with Spring Security and target them specifically by using STOMP’s user-specific methods. We’ll also use a message queue (namely, Apache ActiveMQ, which must be installed on your computer) to temporarily store messages before sending them out. And as for the transport between the queue and our message dispatchers, we’ll use Apache Camel.

Read more...

We live in the age of digitized social interaction. As demonstrated by the countless gameplay video streams of games over 20 years old, we feel the need to socialize with even the most static digital content. Now, everything is collaborative, en masse and in real-time, so web apps need to be able to handle this concurrent and user-scoped data in an elegant fashion in order to survive.

The traditional approach to handing out clients data in real-time (or quasi-real-time) was to make clients poll the server at regular intervals. This could be achieved by a simple polling (say, every 5 seconds), or long-polling (same as the other, but with longer-lasting sockets and late responses), but now there are new kids in town. The new approach to this situation is to let the server push the data using a publish/subscribe mechanism, rather than the client pulling them in, and technologies like Comet, WebSocket, Server-Sent Events were created for this exact purpose.

This article will demonstrate a simple guestbook app that uses the WebSocket method, and will feature Spring Boot and STOMP on the server side, and SockJS and stomp.js on the client side.

Read more...
·415 words·2 mins

Developers who are new to a language or a platform are usually greeted by encoding issues. One example is beginner PHP/MySQL developers. They usually create a simple form page, post some data with it, persist that data with on the back-end, refresh the page, and realize that all unicode characters are gone and in their place, there are some weird, incomprehensible characters.

I’ve recently encountered a similar problem in one of my projects, namely, a desktop application written in C# running on Mono. When run on OS X, my app began acting strangely, and when I looked at the logs, I realized that all umlauts/diacritics/accents on my characters were next to the base characters, rather than on top or bottom. Here’s an example:

Read more...
·383 words·2 mins

While investigating how services like Shazam worked, how they identified music using audio samples, I stumbled upon Echoprint, an open-source music identification project, and when I did, I immediately jumped to experiment with it.

The Echoprint project has many sub-projects in itself, but the simplest way to use it is to send the audio sample in a specific format to an Echoprint server. The Echoprint project already has a free-to-use (keep in mind that with “free” comes request limitations) online Echoprint server that identifies the music for you, so you only need to create an appropriate code to call the service.

The echoprint-codegen project is used exactly for that purpose: it takes an audio input and produces a code out of it, ready to use in Echoprint service requests. There are no binary distributions for the project, so you need to manually build it after downloading (or cloning) the project on your PC.

First, clone the project from the Github repository.

Read more...