Adobe Flash Media Server chat



我正在使用Flash Media Development Server 4.5创建一个小型聊天应用程序。我已经在Flash中创建了所有用户界面组件。

要拥有聊天应用程序,用户需要相互来回发送消息。Flash 播放器如何连接到其他 Flash 播放器?例如,如果您有一个由 20 名成员组成的组。如何将特定消息发送到客户端而不是组?

聊天应用程序的示例 www.red5chat.com。免费使用。并检查代码闪存和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);
            }   
        }
    }

最新更新