我正在使用Flash Media Development Server4.5创建一个小型聊天应用程序。我已经在Flash中创建了所有的用户界面组件。
要使用聊天应用程序,用户需要相互之间来回发送消息。Flash player如何连接到其他Flash player?例如,如果您有一个由20个成员组成的组。如何将特定消息发送到客户端而不是群组?
发布于 2013-02-07 15:43:27
聊天应用程序的示例是www.red5chat.com。免费使用。并检查代码flash和Java。向服务器中的客户端代码发送私人消息是
public void send_private(String fromPseudo, String DestinationID,String msg) {
//IConnection current = Red5.getConnectionLocal();
Iterator<IConnection> it = scope.getConnections();
log.debug("send_private to "+DestinationID+" "+msg);
//String uid = scope.getClient().getId();
while (it.hasNext()) {
IConnection conn = it.next();
String id=conn.getClient().getId();
log.debug("id="+id+ " senTO="+DestinationID);
//if (sendTo.equals(id)) log.info("PAREIL"); else log.info("differents");
if (!(DestinationID.equals(id))) continue;
log.info("receive_private "+DestinationID+" "+msg);
if (conn instanceof IServiceCapableConnection) {
((IServiceCapableConnection) conn).invoke("receivePrivateMsg", new Object[]{fromPseudo, msg});
log.info("received_private "+DestinationID+" "+msg);
}
}
}
https://stackoverflow.com/questions/13661941
复制相似问题