Technology

Mouse Pointer Communicator - mmunicater

Explore the innovative use of jQuery and Socket.io in creating a real-time web communicator that displays users as small colored squares, enhancing web interaction without overloading server resources.

Sangrak

Inspired by firejune{:target="_blank"}'s Mouse Pointer Communicator - Smails, I ventured into building my version using jQuery and Socket.io. The goal was to represent users as tiny rectangles of no more than 10 pixels, identified by the color of their socket id, though the color isn't unique to each user, which is a drawback.

My first project with socket.io was a chat room, but as user numbers grew, so did server performance issues - likely due to my coding. This time, I aimed to truly test nodejs performance. It's currently implemented on various sites, including this blog, but only for this post.

Reacting Events

The system captures and transmits data on mouse movement, and mouse down and up events.

Performance Issues

Instead of emitting the mouse's position at every move, it emits at set intervals. Previously, constant emits with increasing users drastically raised data exchange, as the mousemove event could occur dozens of times per second. While updates from other pointers are received in real-time, updates are spaced out to minimize JavaScript calculations.

Compatibility List

  • Google Chrome
  • Apple Safari
  • Internet Explorer 7, 8 (untested on 9)

Demo

View it on this page or at http://mmunicater.sock.io/{:target="_blank"}.

More on this topic