# Websocket over ActiveMQ ## TL;DR - Websocket over ActiveMQ not suitable for our purpose ## Pros - WS-MQ has build in error message and security. - We could connect to the MQ-server using different protocol (WS,STOMP,openwire,AMQP,MQTT) ## Cons - We need to custom the Authentication in ActiveMQ (create activeMQ plugin in Java) - We want ActiveMQ to recognize the matrix_access_token for authentication. - We want to have a connection manager in ActiveMQ (create activeMQ plugin in Java) - This module will handle 1 device = 1 connection mapping. - This module will handle who are eligible to receive the messages. - Because in Message Queue (MQ), the client has to listen to Topic or Queue, these mean everyone who listen to the same `Topic` or `Queue` willl receive the message. ![](https://i.imgur.com/nqGMb3K.png) - In chat application, we want the host (Server) able to send a message to a particular connection. (we need connection manager for this) ## Summarize I suggest to use the ordinary Websockets 1. It would take more time to develop the MQ plugin since we are not familiar with Message Queue. 2. The others enterprise chat service also use Message Queue as service for background process, not for handling authentication and connection manager. Ref: https://www.codekarle.com/system-design/Whatsapp-system-design.html 3. We still using ActiveMQ in the background, but the Authentication and connection manager is handled by our own Websockets service.