Merge branch 'merge-polling-with-master' of github.com:antobinary/bigbluebutton into merge-polling-with-master
This commit is contained in:
commit
970be7f8d9
@ -1,7 +1,5 @@
|
||||
|
||||
package org.bigbluebutton.conference.service.chat;
|
||||
|
||||
|
||||
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
|
||||
import org.bigbluebutton.conference.service.messaging.redis.MessageHandler;
|
||||
import com.google.gson.JsonParser;
|
||||
@ -19,11 +17,10 @@ public class ChatMessageListener implements MessageHandler{
|
||||
public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) {
|
||||
this.bbbGW = bbbGW;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleMessage(String pattern, String channel, String message) {
|
||||
if (channel.equalsIgnoreCase(MessagingConstants.TO_CHAT_CHANNEL)) {
|
||||
System.out.println("AntonChannel=(chatlistener)" + channel);
|
||||
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(message);
|
||||
@ -34,57 +31,60 @@ public class ChatMessageListener implements MessageHandler{
|
||||
String eventName = headerObject.get("name").toString();
|
||||
eventName = eventName.replace("\"", "");
|
||||
|
||||
if (eventName.equalsIgnoreCase("public_chat_message_event") ||
|
||||
eventName.equalsIgnoreCase("send_public_chat_message") ||
|
||||
if (eventName.equalsIgnoreCase("public_chat_message_event") ||
|
||||
//eventName.equalsIgnoreCase("send_public_chat_message") ||
|
||||
eventName.equalsIgnoreCase("private_chat_message_event") ||
|
||||
eventName.equalsIgnoreCase("send_private_chat_message")){
|
||||
//eventName.equalsIgnoreCase("send_private_chat_message") ||
|
||||
eventName.equalsIgnoreCase("get_chat_history")){
|
||||
|
||||
String meetingID = payloadObject.get("meeting_id").toString().replace("\"", "");
|
||||
String requesterID = payloadObject.get("requester_id").toString().replace("\"", "");
|
||||
String chatType = messageObject.get("chatType").toString().replace("\"", "");
|
||||
String fromUserID = messageObject.get("fromUserID").toString().replace("\"", "");
|
||||
String fromUsername = messageObject.get("fromUsername").toString().replace("\"", "");
|
||||
String fromColor = messageObject.get("fromColor").toString().replace("\"", "");
|
||||
String fromTime = messageObject.get("fromTime").toString().replace("\"", "");
|
||||
String fromTimezoneOffset = messageObject.get("fromTimezoneOffset").toString().replace("\"", "");
|
||||
String fromLang = messageObject.get("fromLang").toString().replace("\"", "");
|
||||
String toUserID = messageObject.get("toUserID").toString().replace("\"", "");
|
||||
String toUsername = messageObject.get("toUsername").toString().replace("\"", "");
|
||||
String chatText = messageObject.get("message").toString().replace("\"", "");
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(ChatKeyUtil.CHAT_TYPE, chatType);
|
||||
map.put(ChatKeyUtil.FROM_USERID, fromUserID);
|
||||
map.put(ChatKeyUtil.FROM_USERNAME, fromUsername);
|
||||
map.put(ChatKeyUtil.FROM_COLOR, fromColor);
|
||||
map.put(ChatKeyUtil.FROM_TIME, fromTime);
|
||||
map.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset);
|
||||
map.put(ChatKeyUtil.FROM_LANG, fromLang);
|
||||
map.put(ChatKeyUtil.TO_USERID, toUserID);
|
||||
map.put(ChatKeyUtil.TO_USERNAME, toUsername);
|
||||
map.put(ChatKeyUtil.MESSAGE, chatText);
|
||||
|
||||
//public message
|
||||
if(eventName.equalsIgnoreCase("public_chat_message_event") || eventName.equalsIgnoreCase("send_public_chat_message")) //put this string into a constants file
|
||||
{
|
||||
System.out.println("I'm in the case for a public chat message" );
|
||||
|
||||
bbbGW.sendPublicMessage(meetingID, requesterID, map);
|
||||
|
||||
}
|
||||
//private message
|
||||
else if(eventName.equalsIgnoreCase("private_chat_message_event") || eventName.equalsIgnoreCase("send_private_chat_message")) //put this string into a constants file
|
||||
{
|
||||
System.out.println("I'm in the case for a private chat message" );
|
||||
|
||||
bbbGW.sendPrivateMessage(meetingID, requesterID, map); //TODO not tested yet
|
||||
}
|
||||
//case getChatHistory
|
||||
else if(eventName.equalsIgnoreCase("get_chat_history")) {
|
||||
System.out.println("I'm in the case for a requesting chat history" );
|
||||
String replyTo = meetingID + "/" + requesterID;
|
||||
if(eventName.equalsIgnoreCase("get_chat_history")) {
|
||||
String replyTo = meetingID + "/" + requesterID;
|
||||
bbbGW.getChatHistory(meetingID, requesterID, replyTo);
|
||||
}
|
||||
else {
|
||||
String chatType = messageObject.get("chatType").toString().replace("\"", "");
|
||||
String fromUserID = messageObject.get("fromUserID").toString().replace("\"", "");
|
||||
String fromUsername = messageObject.get("fromUsername").toString().replace("\"", "");
|
||||
String fromColor = messageObject.get("fromColor").toString().replace("\"", "");
|
||||
String fromTime = messageObject.get("fromTime").toString().replace("\"", "");
|
||||
String fromTimezoneOffset = messageObject.get("fromTimezoneOffset").toString().replace("\"", "");
|
||||
String fromLang = messageObject.get("fromLang").toString().replace("\"", "");
|
||||
String toUserID = messageObject.get("toUserID").toString().replace("\"", "");
|
||||
String toUsername = messageObject.get("toUsername").toString().replace("\"", "");
|
||||
String chatText = messageObject.get("message").toString().replace("\"", "");
|
||||
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(ChatKeyUtil.CHAT_TYPE, chatType);
|
||||
map.put(ChatKeyUtil.FROM_USERID, fromUserID);
|
||||
map.put(ChatKeyUtil.FROM_USERNAME, fromUsername);
|
||||
map.put(ChatKeyUtil.FROM_COLOR, fromColor);
|
||||
map.put(ChatKeyUtil.FROM_TIME, fromTime);
|
||||
map.put(ChatKeyUtil.FROM_TZ_OFFSET, fromTimezoneOffset);
|
||||
map.put(ChatKeyUtil.FROM_LANG, fromLang);
|
||||
map.put(ChatKeyUtil.TO_USERID, toUserID);
|
||||
map.put(ChatKeyUtil.TO_USERNAME, toUsername);
|
||||
map.put(ChatKeyUtil.MESSAGE, chatText);
|
||||
|
||||
//public message
|
||||
if(eventName.equalsIgnoreCase("public_chat_message_event") || eventName.equalsIgnoreCase("send_public_chat_message")) //put this string into a constants file
|
||||
{
|
||||
System.out.println("I'm in the case for a public chat message" );
|
||||
|
||||
bbbGW.sendPublicMessage(meetingID, requesterID, map);
|
||||
}
|
||||
|
||||
//private message
|
||||
else if(eventName.equalsIgnoreCase("private_chat_message_event") || eventName.equalsIgnoreCase("send_private_chat_message")) //put this string into a constants file
|
||||
{
|
||||
System.out.println("I'm in the case for a private chat message" );
|
||||
|
||||
bbbGW.sendPrivateMessage(meetingID, requesterID, map); //TODO not tested yet
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,5 +84,6 @@ public class Constants {
|
||||
public static final String JOINED = "joined";
|
||||
public static final String X_PERCENT = "x_percent";
|
||||
public static final String Y_PERCENT = "y_percent";
|
||||
public static final String KEEP_ALIVE_ID = "keep_alive_id";
|
||||
public static final String KEEP_ALIVE_ID = "keep_alive_id";
|
||||
public static final String INTERNAL_USER_ID = "internal_user_id";
|
||||
}
|
||||
|
@ -24,14 +24,17 @@ public class MessageFromJsonConverter {
|
||||
return processEndMeetingMessage(payload);
|
||||
case KeepAliveMessage.KEEP_ALIVE_REQUEST:
|
||||
return processKeepAlive(payload);
|
||||
case RegisterUserMessage.REGISTER_USER:
|
||||
System.out.println("Registering a user");
|
||||
return RegisterUserMessage.fromJson(message);
|
||||
case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN:
|
||||
return processValidateAuthTokenMessage(header, payload);
|
||||
case UserConnectedToGlobalAudio.USER_CONNECTED_TO_GLOBAL_AUDIO:
|
||||
System.out.println("Converting message to UserConnectedToGlobalAudio");
|
||||
return UserConnectedToGlobalAudio.fromJson(message);
|
||||
return UserConnectedToGlobalAudio.fromJson(message);
|
||||
case UserDisconnectedFromGlobalAudio.USER_DISCONNECTED_FROM_GLOBAL_AUDIO:
|
||||
System.out.println("Converting message to UserDisconnectedFromGlobalAudio");
|
||||
return UserDisconnectedFromGlobalAudio.fromJson(message);
|
||||
return UserDisconnectedFromGlobalAudio.fromJson(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@ -24,22 +24,22 @@ public class MessagingConstants {
|
||||
public static final String FROM_BBB_APPS_PATTERN = FROM_BBB_APPS_CHANNEL + ":*";
|
||||
public static final String FROM_SYSTEM_CHANNEL = FROM_BBB_APPS_CHANNEL + ":system";
|
||||
public static final String FROM_MEETING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":meeting";
|
||||
public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation";
|
||||
public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling";
|
||||
public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users";
|
||||
public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat";
|
||||
public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard";
|
||||
|
||||
public static final String FROM_PRESENTATION_CHANNEL = FROM_BBB_APPS_CHANNEL + ":presentation";
|
||||
public static final String FROM_POLLING_CHANNEL = FROM_BBB_APPS_CHANNEL + ":polling";
|
||||
public static final String FROM_USERS_CHANNEL = FROM_BBB_APPS_CHANNEL + ":users";
|
||||
public static final String FROM_CHAT_CHANNEL = FROM_BBB_APPS_CHANNEL + ":chat";
|
||||
public static final String FROM_WHITEBOARD_CHANNEL = FROM_BBB_APPS_CHANNEL + ":whiteboard";
|
||||
|
||||
public static final String TO_BBB_APPS_CHANNEL = "bigbluebutton:to-bbb-apps";
|
||||
public static final String TO_BBB_APPS_PATTERN = TO_BBB_APPS_CHANNEL + ":*";
|
||||
public static final String TO_MEETING_CHANNEL = TO_BBB_APPS_CHANNEL + ":meeting";
|
||||
public static final String TO_SYSTEM_CHANNEL = TO_BBB_APPS_CHANNEL + ":system";
|
||||
public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation";
|
||||
public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling";
|
||||
public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users";
|
||||
public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat";
|
||||
public static final String TO_PRESENTATION_CHANNEL = TO_BBB_APPS_CHANNEL + ":presentation";
|
||||
public static final String TO_POLLING_CHANNEL = TO_BBB_APPS_CHANNEL + ":polling";
|
||||
public static final String TO_USERS_CHANNEL = TO_BBB_APPS_CHANNEL + ":users";
|
||||
public static final String TO_CHAT_CHANNEL = TO_BBB_APPS_CHANNEL + ":chat";
|
||||
|
||||
|
||||
|
||||
public static final String DESTROY_MEETING_REQUEST_EVENT = "DestroyMeetingRequestEvent";
|
||||
public static final String CREATE_MEETING_REQUEST_EVENT = "CreateMeetingRequestEvent";
|
||||
public static final String END_MEETING_REQUEST_EVENT = "EndMeetingRequestEvent";
|
||||
@ -49,7 +49,6 @@ public class MessagingConstants {
|
||||
public static final String USER_JOINED_EVENT = "UserJoinedEvent";
|
||||
public static final String USER_LEFT_EVENT = "UserLeftEvent";
|
||||
public static final String USER_STATUS_CHANGE_EVENT = "UserStatusChangeEvent";
|
||||
public static final String SEND_POLLS_EVENT = "SendPollsEvent";
|
||||
public static final String SEND_POLLS_EVENT = "SendPollsEvent";
|
||||
public static final String RECORD_STATUS_EVENT = "RecordStatusEvent";
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
package org.bigbluebutton.conference.service.messaging;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class RegisterUserMessage implements IMessage {
|
||||
public static final String REGISTER_USER = "register_user_request";
|
||||
public static final String REGISTER_USER = "register_user_request";
|
||||
public final String VERSION = "0.0.1";
|
||||
|
||||
|
||||
public final String meetingID;
|
||||
public final String internalUserId;
|
||||
public final String fullname;
|
||||
public final String role;
|
||||
public final String externUserID;
|
||||
public final String authToken;
|
||||
|
||||
|
||||
public RegisterUserMessage(String meetingID, String internalUserId, String fullname, String role, String externUserID, String authToken) {
|
||||
this.meetingID = meetingID;
|
||||
this.internalUserId = internalUserId;
|
||||
@ -19,4 +23,51 @@ public class RegisterUserMessage implements IMessage {
|
||||
this.externUserID = externUserID;
|
||||
this.authToken = authToken;
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
HashMap<String, Object> payload = new HashMap<String, Object>();
|
||||
|
||||
payload.put(Constants.MEETING_ID, meetingID);
|
||||
payload.put(Constants.INTERNAL_USER_ID, internalUserId);
|
||||
payload.put(Constants.NAME, fullname);
|
||||
payload.put(Constants.ROLE, role);
|
||||
payload.put(Constants.EXT_USER_ID, externUserID);
|
||||
payload.put(Constants.AUTH_TOKEN, authToken);
|
||||
|
||||
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(REGISTER_USER, VERSION, null);
|
||||
|
||||
return MessageBuilder.buildJson(header, payload);
|
||||
}
|
||||
public static RegisterUserMessage fromJson(String message) {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(message);
|
||||
|
||||
if (obj.has("header") && obj.has("payload")) {
|
||||
JsonObject header = (JsonObject) obj.get("header");
|
||||
JsonObject payload = (JsonObject) obj.get("payload");
|
||||
|
||||
if (header.has("name")) {
|
||||
String messageName = header.get("name").getAsString();
|
||||
if (REGISTER_USER.equals(messageName)) {
|
||||
if (payload.has(Constants.MEETING_ID)
|
||||
&& payload.has(Constants.NAME)
|
||||
&& payload.has(Constants.ROLE)
|
||||
&& payload.has(Constants.EXT_USER_ID)
|
||||
&& payload.has(Constants.AUTH_TOKEN)) {
|
||||
|
||||
String meetingID = payload.get(Constants.MEETING_ID).getAsString();
|
||||
String fullname = payload.get(Constants.NAME).getAsString();
|
||||
String role = payload.get(Constants.ROLE).getAsString();
|
||||
String externUserID = payload.get(Constants.EXT_USER_ID).getAsString();
|
||||
String authToken = payload.get(Constants.AUTH_TOKEN).getAsString();
|
||||
|
||||
//use externalUserId twice - once for external, once for internal
|
||||
return new RegisterUserMessage(meetingID, externUserID, fullname, role, externUserID, authToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Failed to parse RegisterUserMessage");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
* Copyright (c) 2014 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@ -47,17 +47,26 @@ public class ParticipantsApplication {
|
||||
bbbInGW.setUserStatus(room, userid, status, value);
|
||||
}
|
||||
|
||||
public boolean participantLeft(String roomName, String userid) {
|
||||
public boolean participantJoin(String roomName, String userid) { //is this used?!
|
||||
log.debug("Participant " + userid + " joining room " + roomName);
|
||||
System.out.println("\n\n\n\n participantJoin is being used \n\n\n");
|
||||
bbbInGW.userJoin(roomName, userid);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean participantLeft(String roomName, String userid) { //is this used?!
|
||||
log.debug("Participant " + userid + " leaving room " + roomName);
|
||||
System.out.println("\n\n\n\n participantLeft is being used \n\n\n");
|
||||
bbbInGW.userLeft(roomName, userid);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public boolean registerUser(String roomName, String userid, String username, String role, String externUserID) {
|
||||
System.out.println("\n\n\n\n registerUser is being used \n\n\n");
|
||||
bbbInGW.registerUser(roomName, userid, username, role, externUserID, userid);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void assignPresenter(String room, String newPresenterID, String newPresenterName, String assignedBy){
|
||||
bbbInGW.assignPresenter(room, newPresenterID, newPresenterName, assignedBy);
|
||||
}
|
||||
|
@ -26,13 +26,12 @@ public class ParticipantsListener implements MessageHandler{
|
||||
JsonObject obj = (JsonObject) parser.parse(message);
|
||||
JsonObject headerObject = (JsonObject) obj.get("header");
|
||||
JsonObject payloadObject = (JsonObject) obj.get("payload");
|
||||
JsonObject messageObject = (JsonObject)payloadObject.get("message");
|
||||
|
||||
String eventName = headerObject.get("name").toString().replace("\"", "");
|
||||
|
||||
if(eventName.equalsIgnoreCase("register_user_request") ||
|
||||
eventName.equalsIgnoreCase("participant_left") || //TODO the event name is probably incorrect
|
||||
eventName.equalsIgnoreCase("participant_join") || //TODO the event name is probably incorrect
|
||||
eventName.equalsIgnoreCase("user_left_event") ||
|
||||
eventName.equalsIgnoreCase("user_joined_event") ||
|
||||
eventName.equalsIgnoreCase("get_users_request") ||
|
||||
eventName.equalsIgnoreCase("raise_user_hand_request")){
|
||||
|
||||
@ -44,18 +43,14 @@ public class ParticipantsListener implements MessageHandler{
|
||||
String role = payloadObject.get("role").toString().replace("\"", "");
|
||||
String externUserID = payloadObject.get("external_user_id").toString().replace("\"", "");
|
||||
|
||||
|
||||
}
|
||||
else if(eventName.equalsIgnoreCase("participant_left")){ //TODO the event name is probably incorrect
|
||||
else if(eventName.equalsIgnoreCase("user_left_event")){
|
||||
String userID = payloadObject.get("user_id").toString().replace("\"", "");
|
||||
|
||||
bbbInGW.userLeft(roomName, userID);
|
||||
}
|
||||
else if(eventName.equalsIgnoreCase("participant_join")){ //TODO the event name is probably incorrect
|
||||
else if(eventName.equalsIgnoreCase("user_joined_event")){
|
||||
String userID = payloadObject.get("user_id").toString().replace("\"", "");
|
||||
String username = payloadObject.get("name").toString().replace("\"", "");
|
||||
String role = payloadObject.get("role").toString().replace("\"", "");
|
||||
String externUserID = payloadObject.get("external_user_id").toString().replace("\"", "");
|
||||
|
||||
bbbInGW.userJoin(roomName, userID);
|
||||
}
|
||||
@ -75,45 +70,6 @@ public class ParticipantsListener implements MessageHandler{
|
||||
bbbInGW.lowerHand(roomName, userID, requesterID);
|
||||
}
|
||||
}
|
||||
|
||||
/* //This code was written to support user_joined_event and user_left_event from
|
||||
//https://github.com/bigbluebutton/bigbluebutton/blob/bbb-apps-wip/server/bbb-apps/src/test/scala/org/bigbluebutton/endpoint/JsonMessagesFixtures.scala
|
||||
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(message);
|
||||
JsonObject header = (JsonObject) obj.get("header");
|
||||
//System.out.println ("header="+header);
|
||||
JsonObject payload = (JsonObject) obj.get("payload");
|
||||
|
||||
String eventName = header.get("name").toString();
|
||||
eventName = eventName.replace("\"", "");//strip off quotations
|
||||
System.out.println("eventName="+eventName);
|
||||
|
||||
JsonObject user = (JsonObject) payload.get("user");
|
||||
JsonObject meeting = (JsonObject) payload.get("meeting");
|
||||
|
||||
String meetingid = meeting.get("id").toString().replace("\"", "");
|
||||
String userID = user.get("id").toString().replace("\"", "");
|
||||
String username = user.get("name").toString().replace("\"", "");
|
||||
String role = user.get("role").toString().replace("\"", "");
|
||||
String externuserID = user.get("external_id").toString().replace("\"", "");*/
|
||||
/*
|
||||
if(eventName.equalsIgnoreCase("user_joined_event")) //put this string into a constants file
|
||||
{
|
||||
System.out.println("I'm in the case for joined_event" );
|
||||
System.out.println("\nmeetingid="+meetingid+", "+"userID = "+userID+", username="+username+
|
||||
", role="+role+"external_id="+externuserID);
|
||||
|
||||
bbbGW.userJoin(meetingid, userID, username, role, externuserID);
|
||||
}
|
||||
else if(eventName.equalsIgnoreCase("user_left_event")) //put this string into a constants file
|
||||
{
|
||||
System.out.println("I'm in the case for left_event" );
|
||||
System.out.println("\nmeetingid="+meetingid+", "+"userID = "+userID);
|
||||
|
||||
bbbGW.userLeft(meetingid, userID);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public interface IBigBlueButtonInGW {
|
||||
void lowerHand(String meetingId, String userId, String loweredBy);
|
||||
void shareWebcam(String meetingId, String userId, String stream);
|
||||
void unshareWebcam(String meetingId, String userId);
|
||||
void setUserStatus(String meetingID, String userID, String status, Object value);
|
||||
void setUserStatus(String meetingID, String userID, String status, Object value);
|
||||
void getUsers(String meetingID, String requesterID);
|
||||
void userLeft(String meetingID, String userID);
|
||||
void userJoin(String meetingID, String userID);
|
||||
@ -38,8 +38,8 @@ public interface IBigBlueButtonInGW {
|
||||
void assignPresenter(String meetingID, String newPresenterID, String newPresenterName, String assignedBy);
|
||||
void setRecordingStatus(String meetingId, String userId, Boolean recording);
|
||||
void getRecordingStatus(String meetingId, String userId);
|
||||
void userConnectedToGlobalAudio(String voiceConf, String userid, String name);
|
||||
void userDisconnectedFromGlobalAudio(String voiceConf, String userid, String name);
|
||||
void userConnectedToGlobalAudio(String voiceConf, String userid, String name);
|
||||
void userDisconnectedFromGlobalAudio(String voiceConf, String userid, String name);
|
||||
|
||||
// Voice
|
||||
void muteAllUsers(String meetingID, String requesterID, Boolean mute);
|
||||
|
@ -30,7 +30,9 @@ config.redis.channels = {}
|
||||
config.redis.channels.fromBBBApps = "bigbluebutton:from-bbb-apps:*"
|
||||
config.redis.channels.toBBBApps = {}
|
||||
config.redis.channels.toBBBApps.pattern = "bigbluebutton:to-bbb-apps:*"
|
||||
config.redis.channels.toBBBApps.chat = "bigbluebutton:to-bbb-apps:chat"
|
||||
config.redis.channels.toBBBApps.meeting = "bigbluebutton:to-bbb-apps:meeting"
|
||||
config.redis.channels.toBBBApps.users = "bigbluebutton:to-bbb-apps:users"
|
||||
config.redis.internalChannels = {}
|
||||
config.redis.internalChannels.receive = "html5-receive"
|
||||
config.redis.internalChannels.reply = "html5-reply"
|
||||
|
@ -18,18 +18,16 @@ module.exports = class ClientProxy
|
||||
@io = socketio.listen(app)
|
||||
@io.set('log level', 1)
|
||||
@io.sockets.on 'connection', (socket) =>
|
||||
console.log "\n\n\n\n I got a connection message\n\n"
|
||||
log.debug({ client: socket.id }, "Client has connected.")
|
||||
socket.on 'message', (jsonMsg) =>
|
||||
log.debug({ message: jsonMsg }, "Received message")
|
||||
log.debug({ message: jsonMsg }, "Received message") # TODO to check whether only 'message' works or 'djhkwa' too
|
||||
@_handleMessage(socket, jsonMsg)
|
||||
socket.on 'disconnect', =>
|
||||
console.log "\n\n\n I got a disconnection message\n\n"
|
||||
@_handleClientDisconnected socket
|
||||
|
||||
# Sends a message in `data` to all the clients that should receive it.
|
||||
sendToClients: (data, callback) ->
|
||||
log.debug({ data: data }, "Sending to client")
|
||||
#log.debug({ data: data }, "Sending to client")
|
||||
|
||||
# the channel can be the user_id (send to one user only) or the meeting_id
|
||||
# (send to everyone in the meeting)
|
||||
@ -42,8 +40,9 @@ module.exports = class ClientProxy
|
||||
# clients = @io.sockets.clients(channel)
|
||||
# console.log "Found", clients?.length, "clients for the channel", channel
|
||||
|
||||
log.debug({ channel: channel, eventName: eventName, message: data, clientCount: clients?.length },
|
||||
"Sending message to websocket clients")
|
||||
#log.debug({ channel: channel, eventName: eventName, message: data, clientCount: clients?.length },
|
||||
# "Sending message to websocket clients")
|
||||
|
||||
# TODO: if `channel` is undefined, it should not send the message,
|
||||
# instead if is sending to all users
|
||||
@io.sockets.in(channel).emit(eventName, data)
|
||||
@ -67,7 +66,7 @@ module.exports = class ClientProxy
|
||||
log.error({ message: message }, 'Unknown message name.')
|
||||
|
||||
_handleLoginMessage: (socket, data) ->
|
||||
@controller.processAuthMessage data, (err, result) ->
|
||||
@controller.processAuthMessage(data, (err, result) ->
|
||||
if err?
|
||||
log.debug({ message: result }, "Sending authentication not OK to user and disconnecting socket")
|
||||
sendMessageToClient(socket, result)
|
||||
@ -84,6 +83,7 @@ module.exports = class ClientProxy
|
||||
|
||||
log.debug({ message: result }, "Sending authentication OK reply to user")
|
||||
sendMessageToClient(socket, result)
|
||||
)
|
||||
|
||||
sendMessageToClient = (socket, message) ->
|
||||
socket.emit(MESSAGE, message)
|
||||
|
@ -58,7 +58,7 @@ module.exports = class RedisPubSub
|
||||
# put the entry in the hash so we can match the response later
|
||||
@pendingRequests[correlationId] = entry
|
||||
message.header.reply_to = correlationId
|
||||
console.log("\n\n\n\n\nmessage=" + JSON.stringify(message) + "\n\n\n")
|
||||
console.log("\n\nmessage=" + JSON.stringify(message) + "\n\n")
|
||||
log.info({ message: message, channel: config.redis.channels.toBBBApps.meeting}, "Publishing a message")
|
||||
@pubClient.publish(config.redis.channels.toBBBApps.meeting, JSON.stringify(message))
|
||||
|
||||
@ -70,13 +70,19 @@ module.exports = class RedisPubSub
|
||||
log.info("Subscribed to #{channel}")
|
||||
|
||||
_onMessage: (pattern, channel, jsonMsg) =>
|
||||
log.debug({ pattern: pattern, channel: channel, message: jsonMsg}, "Received a message from redis")
|
||||
# TODO: this has to be in a try/catch block, otherwise the server will
|
||||
# crash if the message has a bad format
|
||||
message = JSON.parse(jsonMsg)
|
||||
|
||||
unless message.header?.name is "keep_alive_reply" #temporarily stop logging the keep_alive_reply message
|
||||
log.debug({ pattern: pattern, channel: channel, message: message}, "Received a message from redis")
|
||||
console.log "=="+JSON.stringify message
|
||||
|
||||
# retrieve the request entry
|
||||
correlationId = message.header?.reply_to
|
||||
|
||||
#correlationId = message.header?.reply_to
|
||||
correlationId = message.payload?.reply_to or message.header?.reply_to
|
||||
console.log "\ncorrelation_id=" + correlationId
|
||||
if correlationId? and @pendingRequests?[correlationId]?
|
||||
entry = @pendingRequests[correlationId]
|
||||
# make sure the message in the timeout isn't triggered by clearing it
|
||||
@ -88,6 +94,68 @@ module.exports = class RedisPubSub
|
||||
topic: entry.replyTo.topic
|
||||
data: message
|
||||
else
|
||||
#sendToController(message)
|
||||
|
||||
if message.header?.name is 'validate_auth_token_reply'
|
||||
if message.payload?.valid is "true"
|
||||
|
||||
#TODO use the message library for these messages. Perhaps put it in Modules?!
|
||||
|
||||
joinMeetingMessage = {
|
||||
"payload": {
|
||||
"meeting_id": message.payload.meeting_id
|
||||
"user_id": message.payload.userid
|
||||
},
|
||||
"header": {
|
||||
"timestamp": new Date().getTime()
|
||||
"reply_to": message.payload.meeting_id + "/" + message.payload.userid
|
||||
"name": "user_joined_event"
|
||||
}
|
||||
}
|
||||
# the user joins the meeting
|
||||
|
||||
@pubClient.publish(config.redis.channels.toBBBApps.users, JSON.stringify(joinMeetingMessage))
|
||||
console.log "just published the joinMeetingMessage in RedisPubSub"
|
||||
|
||||
#get the list of users in the meeting
|
||||
getUsersMessage = {
|
||||
"payload": {
|
||||
"meeting_id": message.payload.meeting_id
|
||||
"requester_id": message.payload.userid
|
||||
},
|
||||
"header": {
|
||||
"timestamp": new Date().getTime()
|
||||
"reply_to": message.payload.meeting_id + "/" + message.payload.userid
|
||||
"name": "get_users_request"
|
||||
}
|
||||
}
|
||||
|
||||
@pubClient.publish(config.redis.channels.toBBBApps.users, JSON.stringify(getUsersMessage))
|
||||
console.log "just published the getUsersMessage in RedisPubSub"
|
||||
|
||||
#get the chat history
|
||||
getChatHistory = {
|
||||
"payload": {
|
||||
"meeting_id": message.payload.meeting_id
|
||||
"requester_id": message.payload.userid
|
||||
},
|
||||
"header": {
|
||||
"timestamp": new Date().getTime()
|
||||
"reply_to": message.payload.meeting_id + "/" + message.payload.userid
|
||||
"name": "get_chat_history"
|
||||
}
|
||||
}
|
||||
|
||||
@pubClient.publish(config.redis.channels.toBBBApps.chat, JSON.stringify(getChatHistory))
|
||||
console.log "just published the getChatHistory in RedisPubSub"
|
||||
|
||||
|
||||
else if message.header?.name is 'get_users_reply'
|
||||
console.log 'got a reply from bbb-apps for get users'
|
||||
sendToController(message)
|
||||
|
||||
else if message.header?.name is 'get_chat_history_reply'
|
||||
console.log 'got a reply from bbb-apps for chat history'
|
||||
sendToController(message)
|
||||
|
||||
sendToController = (message) ->
|
||||
|
@ -12,10 +12,12 @@ define [
|
||||
@socket = null
|
||||
@host = window.location.protocol + "//" + window.location.host
|
||||
|
||||
# Grab pieces of info from the URL
|
||||
@authToken = @getUrlVars()["auth_token"]
|
||||
@userId = @getUrlVars()["user_id"]
|
||||
@meetingId = @getUrlVars()["meeting_id"]
|
||||
|
||||
@username = @getUrlVars()["username"]
|
||||
console.log "username=" + @username
|
||||
|
||||
disconnect: ->
|
||||
if @socket?
|
||||
@ -25,23 +27,18 @@ define [
|
||||
console.log "tried to disconnect but it's not connected"
|
||||
|
||||
connect: ->
|
||||
|
||||
console.log("user_id=" + @userId + " auth_token=" + @authToken + " meeting_id=" + @meetingId)
|
||||
unless @socket?
|
||||
console.log "connecting to the socket.io server", @host
|
||||
@socket = io.connect()# 2 channels for mass message or indiv (or better??)
|
||||
@socket = io.connect()
|
||||
|
||||
#@individual = io.connect()
|
||||
|
||||
#@group = io.connect()
|
||||
# a1 - just a random
|
||||
#@socket = io.connect('#{@host}/a1/#{meetingId}/#{userId}') #TODO
|
||||
|
||||
@_registerEvents()
|
||||
else
|
||||
console.log "tried to connect but it's already connected"
|
||||
|
||||
# authenticate: (userId, meetingId) ->
|
||||
# @socket.emit "message", message
|
||||
|
||||
emit: (data) ->
|
||||
if @isConnected()
|
||||
@socket.emit("message", data)
|
||||
@ -70,20 +67,30 @@ define [
|
||||
|
||||
message = {
|
||||
"payload": {
|
||||
"auth_token": @authToken
|
||||
"userid": @userId
|
||||
"meeting_id": @meetingId
|
||||
"auth_token": @authToken
|
||||
"userid": @userId
|
||||
"meeting_id": @meetingId
|
||||
},
|
||||
"header": {
|
||||
"timestamp": new Date().getTime()
|
||||
"name": "validate_auth_token"
|
||||
"timestamp": new Date().getTime()
|
||||
"name": "validate_auth_token"
|
||||
}
|
||||
}
|
||||
|
||||
validFields = @authToken? and @userId? and @meetingId?
|
||||
#emit the validate_auth_token json message if the fields have been populated
|
||||
if @authToken? and @userId? and @meetingId?
|
||||
@socket.emit "message", message
|
||||
|
||||
#emit the validate token json message
|
||||
@socket.emit "message", message if validFields
|
||||
@socket.on "get_users_reply", (message) =>
|
||||
users = []
|
||||
for user in message.payload?.users
|
||||
users.push user
|
||||
|
||||
globals.events.trigger("connection:load_users", users)
|
||||
|
||||
@socket.on "get_chat_history_reply", (message) ->
|
||||
alert 'got these messages:' + JSON.stringify message
|
||||
globals.events.trigger("connection:all_messages", message)
|
||||
|
||||
# Received event to logout yourself
|
||||
@socket.on "logout", ->
|
||||
@ -227,22 +234,6 @@ define [
|
||||
console.log "socket on: user list change"
|
||||
globals.events.trigger("connection:user_list_change", users)
|
||||
|
||||
# TODO: event name with spaces is bad
|
||||
###@socket.on "loadUsers", (loadUsersEventObject) =>
|
||||
users = loadUsersEventObject.usernames
|
||||
console.log "socket on: loadUsers" + loadUsersEventObject
|
||||
globals.events.trigger("users:loadUsers", users)###
|
||||
|
||||
# Received event for a new user
|
||||
@socket.on "UserJoiningRequest", (message) => #TODO MUST REMOVE WHEN NOT USED ANYMORE
|
||||
#console.log "socket on: UserJoiningRequest"
|
||||
#console.log message
|
||||
#eventObject = JSON.parse(message);
|
||||
console.log "message: " + message
|
||||
userid = message.user.metadata.userid #TODO change to new json structure
|
||||
username = message.user.name #TODO change to new json structure
|
||||
globals.events.trigger("connection:user_join", userid, username)
|
||||
|
||||
# Received event for a new user
|
||||
@socket.on "user_joined_event", (message) =>
|
||||
console.log "message: " + message
|
||||
@ -256,11 +247,6 @@ define [
|
||||
userid = message.payload.user.id
|
||||
globals.events.trigger("connection:user_left", userid)
|
||||
|
||||
# Received event when a user leave
|
||||
@socket.on "user leave", (userid) =>
|
||||
console.log "socket on: user leave"
|
||||
globals.events.trigger("connection:user_leave", userid)
|
||||
|
||||
# Received event to set the presenter to a user
|
||||
# @param {string} userID publicID of the user that is being set as the current presenter
|
||||
@socket.on "setPresenter", (userid) =>
|
||||
|
@ -34,18 +34,10 @@ module.exports = class MainRouter
|
||||
authToken = req.query.auth_token
|
||||
|
||||
console.log "\n\nLANDING PAGE PROVIDED:\n" +
|
||||
"meeting_id=#{meetingId}\n" +
|
||||
"user_id=#{userId}\n" +
|
||||
"auth_token=#{authToken}\n\n"
|
||||
"meeting_id= #{meetingId}\n" +
|
||||
"user_id= #{userId}\n" +
|
||||
"auth_token= #{authToken}\n\n"
|
||||
|
||||
#go straight into the session view
|
||||
res.render "index",
|
||||
title: config.appName
|
||||
|
||||
|
||||
|
||||
###@clientProxy = config.modules.get("ClientProxy")
|
||||
console.log "\n\n\n\n about to send a request\n"
|
||||
@clientProxy.sendToClients(message, () ->
|
||||
console.log "\n\n\n\nSent the request for auth\n\n\n\n"
|
||||
)###
|
||||
|
@ -38,7 +38,7 @@ login = (req, resp) ->
|
||||
"\nauth_token = " + auth_token
|
||||
|
||||
url = "http://192.168.0.203:3000/html5.client?meeting_id=" + meeting_id + "&user_id=" +
|
||||
user_id + "&auth_token=" + auth_token
|
||||
user_id + "&auth_token=" + auth_token + "&username=" + JSON.parse(joinParams.fullName)
|
||||
|
||||
json =
|
||||
resp.json({
|
||||
|
Loading…
Reference in New Issue
Block a user