Adobe Flash Media Server聊天

时间:2012-12-01 17:41:11

标签: flash chat flash-media-server videochat

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

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

1 个答案:

答案 0 :(得分:0)

聊天应用程序的示例是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);
            }   
        }
    }