This year everyone in the hype Web2.0, one of the technology Ajax is also followed by fire, so I wrote a paper called "Cheat Ajax" article, simply analyze the essence of AJAX technology. Although I do not like to follow the follow, but there are some areas of Ajax is more useful. Some time ago did a EASYJF open source team of online conferencing system, used AJAX technology, the following design ideas issued to share with you.
The function of system realization
This conference room system is mainly used for members of the EASYJF open source team online meeting, the conference system simulates the traditional meeting form, can open a number of different themes at the same time meeting room, each meeting room needs to provide access control function, meeting can designate the meeting speaking mode (divided into lines, free speech two), The system can automatically record the speech information of each meeting room, which can be consulted by the participants for a long time.
The conferencing system's users support the visitor account to attend the meeting, but also provides the interface with other user's system, for instance EASYJF website Open Source Forum system.
The conference system temporarily uses text chat and provides voice and video interfaces.
Second, the technical system
The server side uses the Java language and MVC uses the Easyjweb framework;
The client uses AJAX technology to interact with server-side data;
Conference history Information storage format uses text format to facilitate system installation and operation, but also easy to manage.
Third, the conference room server Side design
The conference Room server is the core part of the whole conference system, and the quality of the whole system is affected by the server-side program design.
First, abstract analysis is based on the functions to be implemented in the Conference room. A conference room object that should include the subject of the meeting, a brief introduction to the meeting, the number of participants, announcements, conference room types, access settings, room password, current attendees, current speakers, people waiting in line to speak, and other parameter information. We encapsulated him in a Java object. As shown in the following chatroom code:
public class ChatRoom{
private String cid;//主键
private String title;//聊天室主题
private String intro;//聊天室简介
private String announce;//聊天室公告
private String owner;//聊天室创建人
private Integer maxUser;//最大在线人数
private Integer intervals;//最大刷新时间间隔
private String vrtype;//访问权限
private String vrvalue;//访问值
private Integer status;//聊天室状态
private Date inputTime;
}
You need a class that manages the conference room, a meeting-related operation (such as starting a meeting, closing a meeting), and so on, find him directly. The class should also have automatic timing to detect the user online (prevent users from accidentally quitting), the memory of the conference history to save the information to a text file medium function. Here you can consider using a Chatservice class to provide these features:
public class ChatService implements Runnable {
private static final Map service=new HashMap();//会议室服务,系统中的当前会议室存放到该表集合中
private static final int maxServices=10;//可以同时开的最大会议室数
private static final SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
private final List msgs;//聊天信息Chat
private final List users;//在线用户,ChatUser
private final List talkers;//排队发言人数Talker
private final List manager;//会议室管理员
private Talker currentTalker;//当前发言人
public ChatService()
{
this.msgs=new ArrayList();
this.users=new ArrayList();
this.talkers=new ArrayList();
this.manager=new ArrayList();
this.maxUser=1000;//最大1000人同时
this.interval=1000*60*5;//5分钟以前的信息
}
}
Conference statement information also needs to be encapsulated into a class that represents the speaker, receiver, content, speaking time, type, and so on, roughly the following chat class:
public class Chat {
private String cid;
private String sender;
private String reciver;
private String content;
private Date vdate;
private Integer types;
private Integer status;
}
There is also information about the person who attended the meeting, including the name of the participant, IP address, status, and so on, as shown in the following Chatuser class:
public class ChatUser {
private String ip;
private String port;
private String userName;
private Date lastAccessTime;
private Integer status;
}
A talker class representing the current spokesperson is also required, indicating the current speaker, the starting time of the speech, the expected end time of the statement, and so on.
In the server side of the design, the conference room information servers should be able to run in a multi-threaded manner, that is, start a meeting to open a new thread, each meeting thread to maintain their own conference status, such as participants, speakers, save the history of the session information and empty the memory of the data and so on.