Search in sources :

Example 1 with StreamClient

use of org.apache.openmeetings.db.entity.room.StreamClient in project openmeetings by apache.

the class MobileService method create.

public StreamClient create(User u, Sessiondata sd) {
    StreamClient c = new StreamClient();
    c.setType(StreamClient.Type.mobile);
    c.setSid(sd.getSessionId());
    c.setUid(UUID.randomUUID().toString());
    return create(c, u);
}
Also used : StreamClient(org.apache.openmeetings.db.entity.room.StreamClient)

Example 2 with StreamClient

use of org.apache.openmeetings.db.entity.room.StreamClient in project openmeetings by apache.

the class RoomBroadcaster method sendUpdatedClient.

public static void sendUpdatedClient(Client client) {
    String uid = client.getUid();
    StreamClient rcl = get().getBean(StreamClientManager.class).update(getClient(uid), true);
    log.debug("-----------  sendUpdatedClient ");
    // Notify all clients of the same scope (room)
    get().getBean(ClientManager.class).update(client);
    broadcast(client.getRoom().getId(), "clientUpdated", rcl);
    if (rcl == null) {
        return;
    }
    get().getBean(StreamClientManager.class).update(rcl);
}
Also used : StreamClientManager(org.apache.openmeetings.web.app.StreamClientManager) StreamClient(org.apache.openmeetings.db.entity.room.StreamClient) ClientManager(org.apache.openmeetings.web.app.ClientManager) StreamClientManager(org.apache.openmeetings.web.app.StreamClientManager)

Example 3 with StreamClient

use of org.apache.openmeetings.db.entity.room.StreamClient in project openmeetings by apache.

the class RoomBroadcaster method broadcast.

public static void broadcast(String publicSid, String method, Object obj) {
    StreamClient rc = getClient(publicSid);
    if (rc == null) {
        return;
    }
    broadcast(rc.getRoomId(), method, obj);
}
Also used : StreamClient(org.apache.openmeetings.db.entity.room.StreamClient)

Example 4 with StreamClient

use of org.apache.openmeetings.db.entity.room.StreamClient in project openmeetings by apache.

the class SessiondataDao method clearSessionByRoomId.

/**
 * @param roomId - room to clear sessions
 */
public void clearSessionByRoomId(Long roomId) {
    try {
        for (StreamClient rcl : streamClientManager.list(roomId)) {
            String aux = rcl.getSwfurl();
            int start = aux.indexOf("sid=") + 4;
            int end = start + 32;
            if (end > aux.length()) {
                end = aux.length();
            }
            String sid = aux.substring(start, end);
            Sessiondata sData = check(sid);
            if (sData != null) {
                em.remove(sData);
            }
        }
    } catch (Exception err) {
        log.error("clearSessionByRoomId", err);
    }
}
Also used : StreamClient(org.apache.openmeetings.db.entity.room.StreamClient) Sessiondata(org.apache.openmeetings.db.entity.server.Sessiondata)

Example 5 with StreamClient

use of org.apache.openmeetings.db.entity.room.StreamClient in project openmeetings by apache.

the class Client method streamJson.

public JSONObject streamJson(String _sid, boolean self, IStreamClientManager mgr) {
    JSONArray _streams = new JSONArray();
    boolean avFound = false;
    for (String _uid : streams) {
        StreamClient rc = mgr.get(_uid);
        if (rc == null) {
            continue;
        }
        Type t = rc.getType();
        if (Type.room == t) {
            avFound = true;
        }
        _streams.put(RoomHelper.addScreenActivities(new JSONObject().put("type", t.name()).put("uid", self && Type.room == t ? uid : rc.getUid()).put("broadcastId", rc.getBroadcastId()).put("width", rc.getWidth()).put("height", rc.getHeight()), rc));
    }
    if (self && !avFound && hasAnyActivity(Activity.broadcastA, Activity.broadcastV)) {
        _streams.put(new JSONObject().put("type", Type.room.name()).put("uid", uid).put("width", width).put("height", height));
    }
    return toJson(self).put("sid", _sid).put("streams", _streams);
}
Also used : JSONObject(com.github.openjson.JSONObject) StreamClient(org.apache.openmeetings.db.entity.room.StreamClient) JSONArray(com.github.openjson.JSONArray)

Aggregations

StreamClient (org.apache.openmeetings.db.entity.room.StreamClient)6 Sessiondata (org.apache.openmeetings.db.entity.server.Sessiondata)2 JSONArray (com.github.openjson.JSONArray)1 JSONObject (com.github.openjson.JSONObject)1 Client (org.apache.openmeetings.db.entity.basic.Client)1 IClient (org.apache.openmeetings.db.entity.basic.IClient)1 User (org.apache.openmeetings.db.entity.user.User)1 RoomMessage (org.apache.openmeetings.db.util.ws.RoomMessage)1 ClientManager (org.apache.openmeetings.web.app.ClientManager)1 StreamClientManager (org.apache.openmeetings.web.app.StreamClientManager)1