backend/src/main/java/com/coolioasjulio/influence/web/WebGame.java
/**
     * Broadcast a message to all connected players.
     *
     * @param type    The message type
     * @param content The content of the message. It will be serialized as JSON.
     */
Broadcast a message to all connected players.
@param type    The message type
@param content The content of the message. It will be serialized as JSON.
Broadcast a message to all connected players . @param type The message type @param content The content of the message . It will be serialized as JSON .
private void broadcast(String type, Object content) {
        Message message = new Message(type, content);
        String json = gson.toJson(message);
        synchronized (endpointMapLock) {
            for (PlayerEndpoint endpoint : endpointMap.values()) {
                endpoint.write(json);
            }
        }
    }
private void broadcast ( String type , Object content ) { Message message = new Message ( type , content ) ; String json = gson . toJson ( message ) ; synchronized ( endpointMapLock ) { for ( PlayerEndpoint endpoint : endpointMap . values ( ) ) { endpoint . write ( json ) ; } } }
Broadcast a message to all connected players.
Broadcast a message to all connected players .
// Create a new message // Serialize the message // Broadcast it to every connected player