21

New And Improved!

I have rewritten the application and fixed a ton of bugs that were causing issues (and extremely high memory usage). If you ran into trouble before, give the new version a spin!

About

Stack Exchange chat is awesome. But there are a couple of missing features that would complete the experience:

  • Showing how far each user has read
  • Indicating when a user is typing

This script aims to solve both of those problems.

Screenshot

Animated screenshot

Download / Install

Instructions for all major browsers are included on the official website:
https://sechat.quickmediasolutions.com

Platform

All major browsers, including Internet Explorer, Edge, Chrome & Chromium, Firefox, Safari, and Opera. (Some browsers may require a UserScript manager.)

Note: the UserScript works in any http://chat.stackexchange.com room. There are currently no plans to expand beyond these rooms.

Contact

You can contact me by email ([email protected]), through GitHub, or by pinging me in the Ask Ubuntu General Room.

License

Both the UserScript and server are released under the MIT license.

Code

The fun part is explaining how all of this works.

The "application" is divided into two parts - a UserScript installed by each client and a server written in C++ (using Qt) that coordinates everything.

Whenever you "see" a new message or start typing, the UserScript sends a small packet to the central server (using a WebSocket connection) which then processes the information and sends it to all of the other users in the room who also have the script installed.

Each connected client that receives the message updates the page to reflect the new information.

You can find the code here:
https://github.com/nathan-osman/sechatr

9
  • How does this script work with private rooms like the Teachers' Lounge? What information does it track exactly? Commented Dec 6, 2015 at 18:27
  • Discussion copy-over from Chat: Well, how does it verify that the user sending the request to the central server is the one he claims he is? What if I send them random payloads informing mod Madara Uchiha is typing since the last 80 hours or so? (also nice work) Commented Dec 6, 2015 at 18:30
  • @MadaraUchiha I have posted a detailed explanation in an answer for you. Commented Dec 7, 2015 at 1:40
  • I've noticed something which I think is a bug - when I have multiple instances of chat open in the same chatroom, one of the two fails to load the icons. I'm not sure how to go about looking into this in a helpful way, though.
    – user29133
    Commented Dec 7, 2015 at 1:40
  • @Emrakul that's a limitation - it won't allow the same person to be in the same room more than once. Only one will work at a time. Commented Dec 7, 2015 at 2:11
  • @NathanOsman Hmm, I can see that. It does look like it's limiting its ability to fetch the current status of everyone else, though. Maybe that's by-design? Thanks for checking, by the way!
    – user29133
    Commented Dec 7, 2015 at 2:14
  • @Emrakul yup, the server rejects connections from clients when the same user and room are provided. Commented Dec 7, 2015 at 2:16
  • How does one identify against the server? i.e. what's stopping me from opening a dummy Socket connection under your name and start broadcasting false information about you? (Or worse, about 10 users at the same time and drive everyone crazy with neverending Typing... animation)? Commented Dec 7, 2015 at 7:08
  • @MadaraUchiha At this point, nothing. Authentication may be implemented in a future release. I'm still working out how to do it. That being said, it would take a considerable amount of effort to abuse the system - it's fairly complex. Commented Dec 7, 2015 at 7:16

1 Answer 1

4

What Gets Sent

Madara Uchiha posted a comment asking about what information was being tracked. This answer should help clarify what's going on.

The Client

When the script sends a message to the server, it is one of four types:

  • active - sent whenever the tab loses or gains focus. Other users will see your image fade when focus is lost.
  • typing - sent whenever you type something in the text box at the bottom of the chat window. Other users will see a flashing dot next to your name. Only the current time is sent to the server - never the contents of the text box.
  • position - sent whenever you "read" a new message. If the tab has focus, this will be sent immediately as each message appears onscreen. If not, the script waits until the tab has focus again to indicate where you've read.
  • ping - empty message sent to keep the socket connection alive.

The first two types of messages (active and typing) can be disabled if you don't want others to find out if the tab has focus or when you're typing.

The Server

Once the server receives a message, it is immediately broadcast to all other clients in that room. This allows the script running in their browsers to display your position and status.

In addition to the first three types of messages described above, the server can send one additional type of message to clients:

  • quit sent when a user's connection is closed. The image of the user who left will fade and disappear.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .