Search in sources :

Example 6 with TextRoomMessage

use of org.apache.openmeetings.db.util.ws.TextRoomMessage in project openmeetings by apache.

the class QuickPollManager method close.

public void close(Client c) {
    Long roomId = c.getRoomId();
    if (!c.hasRight(Room.Right.presenter) || !isStarted(roomId)) {
        return;
    }
    map().remove(roomId);
    WebSocketHelper.sendRoom(new TextRoomMessage(roomId, c, Type.quickPollUpdated, c.getUid()));
}
Also used : TextRoomMessage(org.apache.openmeetings.db.util.ws.TextRoomMessage)

Example 7 with TextRoomMessage

use of org.apache.openmeetings.db.util.ws.TextRoomMessage in project openmeetings by apache.

the class QuickPollManager method vote.

public void vote(Client c, boolean vote) {
    Long roomId = c.getRoomId();
    IMap<Long, Map<Long, Boolean>> polls = map();
    polls.lock(roomId);
    if (polls.containsKey(roomId)) {
        Map<Long, Boolean> votes = map().get(roomId);
        if (!votes.containsKey(c.getUserId())) {
            votes.put(c.getUserId(), vote);
            polls.put(roomId, votes);
            WebSocketHelper.sendRoom(new TextRoomMessage(roomId, c, Type.quickPollUpdated, c.getUid()));
        }
    }
    polls.unlock(roomId);
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) IMap(com.hazelcast.core.IMap) Map(java.util.Map) TextRoomMessage(org.apache.openmeetings.db.util.ws.TextRoomMessage)

Aggregations

TextRoomMessage (org.apache.openmeetings.db.util.ws.TextRoomMessage)7 IMap (com.hazelcast.core.IMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Client (org.apache.openmeetings.db.entity.basic.Client)2 RoomMessage (org.apache.openmeetings.db.util.ws.RoomMessage)2 JSONObject (com.github.openjson.JSONObject)1 WsMessageRoomMsg (org.apache.openmeetings.core.util.ws.WsMessageRoomMsg)1 Type (org.apache.openmeetings.db.util.ws.RoomMessage.Type)1 NullStringer (org.apache.openmeetings.util.NullStringer)1 Activity (org.apache.openmeetings.web.room.activities.Activity)1 IPartialPageRequestHandler (org.apache.wicket.core.request.handler.IPartialPageRequestHandler)1 WebSocketPushPayload (org.apache.wicket.protocol.ws.api.event.WebSocketPushPayload)1