Keep your friends close: introducing the friend system

A lot of online communities offer some kind of friend system, the most obvious example of course being Facebook. While I have no plans whatsoever to become the next Facebook, a friend system is something I've wanted to add to Whisthub for a very, very long time. There are some good reasons why it took so long, but most importantly now is finally the time!

This blog post mainly focuses on the challenges that had to be overcome to implement the friend system. If you just want to know how it works and what functionalities it offers, then check out this page which explains the functionalities of the friend system in depth with interactive examples!

Anyway, the most important parts of the friend system are that:

  • You can now add other players as friends in your settings.
  • If you have a premium subscription, you will be able to invite your friends to your rooms, provided that they are available.
  • You can receive invitations from your friends if your status is set to available. You can set your status on the home page for a certain period and for certain games. As long as you are available, your friends can see this and they can send you an invitation. Optionally you can specify that anyone can send you an invitation if you are available, not just your friends.
  • Invitations will be sent via push notifications, so you don't need to keep the website open to receive the invitations. Go watch some Netflix, and when someone sends you an invitation, you can just press pause and go play some cards with your Whisthub buddies!
  • You can choose to receive a notification whenever one of your friends sets their status to available in your settings.
An example of a push notification with an invitation
Example of a push notification with an invitation from one of your friends

Well that doesn't look all that complicated, does it? I already had this concept in my mind for a long time, and it isn't really revolutionary either, but then why did it take so long to add this system to Whisthub?

The main reason is that I needed a proper way to tell whether a user is online or not. Obviously I could just check if a user is connected to the Whisthub server, but that doesn't really work because on your desktop, you can leave Whisthub open in the background while you are away, which will keep the connection alive and hence show that you are online, while you could have gone shopping for groceries.

As a solution for this, I was thinking to use your activity on Whisthub. For example, if you viewed a page on Whisthub in the last 10 minutes, then you could be considered online. However, this basically means spying on users, which is a clear no-go, so I abandoned this idea quite quickly.

On mobile devices, such as a tablet or a smartphone, the problem of knowing when you are online is even worse because the connection with the server is closed if you move away from Whisthub. You might already have noticed this by the way: if you create a room, but then navigate away from Whisthub for a few seconds to do something else in another app, then it's possible that the room is cancelled by the time you come back. This means that in order to appear online on a mobile device, you would need to just stare at Whisthub until you get an invitation. This is of course completely ridiculous as the entire idea of invitations is that you don't have to be around all the time.

Okay, so we can't rely on the connection with the server to determine if you're up for receiving invitations or not. How do we get around this? Well, on Whisthub I truly value privacy, and not like some other websites say I value your privacy and then force you to accept tracking cookies and a whole other bunch of crap so we can target ads better. Remember the cookie banner on Whisthub? Yeah that's right, there was none, because we only use one cookie: the one that is technically required to keep you logged in if you visit Whisthub again.

Sorry, I got carried away a little there, but as I was saying, I truly value privacy, so the best way is letting the users decide for themselves when and who can send them invitations. That's what the system of setting your status is responsible for. If you know that, for example, the next 2 hours you have nothing to do, and you see that none of your friends are currently available, then just set your status as available for the next two hours and go do something else!

That sounds good, right? Well, the problem until recently was that even if you set your status to available, the invitations still need a way to reach you. This is what I was finally able to solve by leveraging push notifications with the Web Push API, which basically means that as a website, we can now send push notifications too. In the past, push notifications could only be sent by native apps, and Whisthub does not have a native app, though we do offer a Progressive Web App. With web push, this limitation is now gone, and it allowed me to finally implement the friend system in a way that I had always wanted.

As you will understand, push notifications are a crucial part of the invitation system. Therefore, you won't be able to set your status if you don't have push notifications enabled on your device. Note that there are still a few caveats. On iPhone or iPad, you must install Whisthub to your homescreen to be able to receive push notifications. On a desktop, the requirement is that your browser is running in the background. You don't necessarily need to have Whisthub open, but your browser must be running or you will not get the push notifications!

If you don't have a device that supports push notifications, then don't worry, you can still use the rest of the functionality that the friend system offers. You can still send invitations to your friends if they are available, and you can also limit access to your rooms for your friends, although both require a premium subscription.

The friend system is one of the biggest additions to Whisthub in a long time, and probably also one of the most anticipated ones. As always, the system is probably not perfect and some tweaks might still be needed in the coming months based on how it is used. I still hope though that it can be useful to you and make your experience on Whisthub better. Go try it out!