What’s the best design for a Spring Websocket multi channel chat app

I did the following tutorial about creating a very basic chat app by using Java Spring Boot and Websockets:


Below are some fragments of the code:


package com.example.websocketdemo.config;  import org.springframework.context.annotation.Configuration; import org.springframework.messaging.simp.config.MessageBrokerRegistry; import org.springframework.web.socket.config.annotation.*;  @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {      @Override     public void registerStompEndpoints(StompEndpointRegistry registry) {         registry.addEndpoint("/ws").setAllowedOrigins("*").withSockJS();     }      @Override     public void configureMessageBroker(MessageBrokerRegistry registry) {         registry.setApplicationDestinationPrefixes("/app");         registry.enableSimpleBroker("/topic");   // Enables a simple in-memory broker     } } 


package com.example.websocketdemo.controller;  import com.example.websocketdemo.model.ChatMessage; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.Payload; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.stereotype.Controller;  @Controller public class ChatController {      @MessageMapping("/chat.sendMessage")     @SendTo("/topic/public")     public ChatMessage sendMessage(@Payload ChatMessage chatMessage) {         return chatMessage;     }      @MessageMapping("/chat.addUser")     @SendTo("/topic/public")     public ChatMessage addUser(@Payload ChatMessage chatMessage,                                SimpMessageHeaderAccessor headerAccessor) {         // Add username in web socket session         headerAccessor.getSessionAttributes().put("username", chatMessage.getSender());         return chatMessage;     }  } 

src\main\resources\static\js\main.js (pseudo-code for simplicity)

var username;  function connect() {   username = getUsernameFromUI();   if (username) {       var socket = new SockJS('/ws');       stompClient = Stomp.over(socket);       stompClient.connect({}, onConnected, onError);   } }  function onConnected() {   stompClient.subscribe('/topic/public', onMessageReceived);   stompClient.send("/app/chat.addUser", {}, JSON.stringify({sender: username, type: 'JOIN'})); }  function sendMessage() {   var chatMessage = {     sender: username,     content: getMessageFromUI(),     type: 'CHAT'   };   stompClient.send("/app/chat.sendMessage", {}, JSON.stringify(chatMessage)); }  function onMessageReceived(payload) {     var message = JSON.parse(payload.body);     switch (true) {       case (message.type === 'JOIN'):         message.content = message.sender + ' joined!';         break;       case (message.type === 'LEAVE'):         message.content = message.sender + ' left!';         break;       default:         // nothing special here         break;     }     displayMessage(message); } 

Here there is a diagram related to the example above:

enter image description here

You can edit it through the following link (pencil icon on the bottom) (sorry the long url):


My Question Is:

What would be the best design for a similar app if now I have the following requirements (similar to a typical chat app, for example: IRC):

  • there are multiple public channels (with N users at the same time) simultaneously
  • there are multiple private channels (with only 2 users) simultaneously
  • of course, private messages can only be read by the 2 involved users

If possible, please provide some code and if you provide some diagram that’s an extra bonus.


Cannabis Domains & Websites, YouTube Channel, Twitter Page, Daily Newspaper. Easy transfer.

Cannabis Domains & Websites; YouTube Channel, Twitter Page, Daily Newspaper. Easy transfer.


Get your piece of the Las Vegas Legal Cannabis market w/the ONLY online…

Cannabis Domains & Websites, YouTube Channel, Twitter Page, Daily Newspaper. Easy transfer.

Is the capacity achieving input of a discrete memoryless channel unique?

Consider a classical discrete memoryless channel (DMC). Let $ p$ be an input probability distribution and $ Q$ be the channel’s transition matrix. $ q = Qp$ is a valid output probability distribution. The components of $ p$ and $ q$ are given as $ p_i$ and $ q_i$ respectively.

The capacity of this channel is given by maximizing the mutual information.

$ $ I = \max_{p}\left[\sum_ip_i\left(\sum_{j}Q_{ij}\log(Q_{ij})\right) – \sum_{j}q_j\log q_j\right]$ $

But, we know (Theorem 2.7.4 in Cover and Thomas, 2006) that $ I(p)$ is concave in $ p$ .

If $ I(p)$ is not simply a linear function (i.e. $ q = Qp$ is not a trivial relationship) and is differentiable everywhere (seems like a reasonable assumption), does this not imply that the capacity achieving $ p$ is unique?

YouTube channel has generated new email address – Google Analytics issues?

We created a second YouTube channel on a domain email account (e.g. info@domainname.co.uk), which we use as a central account for account access for our clients. However doing this suddenly created a brand account and our domain email address (e.g. info@domainname.co.uk) has now changed on the account to (infodomainname@gmail.co.uk), without alerting us to this change.

Now I am very concerned we will now lose access to all client accounts because of this change we were not aware of. When I go into settings it won’t let me change the main email address back to the domain one, but the domain email address is still being mentioned as getting alerts etc.

Right now it seems access still works and we can login with the domain email account credentials.

But can someone let me know if: 1. We will lose access to anything that granted us access to the domain email address soon (right now we haven’t but it has only just happened). 2. Will we not be able to login using the domain email address soon (right now we still can but it has only just happened). 3. Can we somehow get the domain email address back to the primary email address (as it won’t let us in account settings) – is this something we have to request from Google or go by another means?

Any advice would be much appreciated, as I am frightened we will lose all our access and permissions soon!

Automatically switch channel mode when headphones are plugged in?

I have an ASUS Xonar DGX soundcard. I was able to get audio playing out-of-the-box, however I am having issues with audio switching when headphones are plugged into the front panel.

I have plugged the “HD Audio” connector from my case directly into the soundcard. Previously, it was plugged into the motherboard and audio switching worked correctly, but I want to use the soundcard for the front panel audio.

I always have speakers plugged into the 3.5mm jack on the soundcard and somtimes have headphones plugged into the front panel 3.5mm jack.

If I open alsamixer, then I can toggle the “Analog Output” channel between:

  • “Stereo Headphones”
  • “Stereo Headphones FP”
  • “Multichannel”

enter image description here

  • If I select “Stereo Headphones”, then audio plays from the speakers.
  • If I select “Multichannel”, then audio plays from the speakers but much louder.
  • If I select “Stereo Headphones FP”, then audio plays from the headphones plugged into the front panel 3.5mm.

What I would like to achieve is when I plug headphones into the front panel, the audio is automatically switched to there. When I unplug the headphones, audio should be automatically switched back to the speakers.

I would also like to maintain separate volume levels for the two 3.5mm jacks.

I am using Ubuntu 18.04.2 LTS.

According to alsamixer I have 3 soundcards, but I only want to use [2] Xonar DGX.

Uploading same video on same channel but shorter

Running a YouTube jokes series, each video 15 minutes long. In each video, there are 10 categories (10 different “types” of jokes). Each category aims at different types of watchers, and each category has a name (lower third) so people can connect with it better.

From comments, it’s obvious that some people like one type of jokes (categories) and others like different ones. Usually, they write “that category is awesome, can’t wait for more”.

Videos we publish must stay in full length (15 mins) because of sponsorship, but for those people that come back and want to see all jokes in a specific category from all past videos, we would like to create playlists.

So, leaving the main videos as they are in full length, we are thinking about creating 10 playlists which would carry category names and uploading 1-2min. videos that are cut from the main video.

Would YouTube consider this spam?

How to get my phone to access WIFI channel 13?

My phone can’t see Wifi 2.4 Channel 13. Why? How can I fix it?

I have an android phone (Moto E4, Android 7.1.1, Not rooted) that was purchased in the US about 12 months ago. Just after purchase,I came to China for a few months, and it worked perfectly on the Wifi here in my home. I had a Chinese sim card. I don’t know what channel my home Wifi was working on last year.

In September, I returned to the US and swapped out the sim card for a US carrier. It continued to work perfectly.

I have just now returned to China, and my phone no longer can see the wifi signal in my home. When I look on my PC, it shows that the Wifi is transmitting on channel 13. When I look in my android app “Wifi Analyzer” it shows a blank space for channel 13. (Also, I forgot my Chinese sim card in the US)

Is this a hardware or a software issue? How to fix this?

Getting Name of MS Teams Channel Message Attachment

I’m trying to get the name of an attachment that was sent to my MS Team Channel’s email. It was posted as a message on the conversation board, which is how I’ve been referencing it.

Right now, I have the message attachment as a Current Item in my dynamic content, but I can’t figure out how to isolate just the attachment name. If I just print out the entire Current Item, I’ll get the following:

{“id”:null,”contentType”:”reference”,”contentUrl”:null,”content”:null,”name”:”Flow Request_2093811450.xlsx”,”thumbnailUrl”:null}.

I need some help splitting the string, so that I’m just getting the name field to print. Any help would be greatly appreciated!

Thank you