Red5 스트리밍 어플리케이션을위한 간단한 서버 측 코드를 작성했습니다. Flex에서 연결하는 동안 클라이언트가 사용자 이름 &을 보내는 지 확인합니다. 서버 측에서red5의 rejectClient 메소드가 flex 클라이언트에 설명을 보내지 않습니다.
이 내 roomConnect 코드입니다 : -
public boolean roomConnect(IConnection conn, Object[] params) {
if (!super.roomConnect(conn, params))
return false;
// reject user if no username and/or password
if(params==null || params.length<2) {
try {
this.rejectClient("No username/password");
}
catch (ClientRejectedException e) {
log.error((String)e.getReason());
}
return false;
}
return true;
}
플렉스 코드 :
protected function connecttored5(event:MouseEvent):void
{
if(conButton.label == "Connect")
{
conButton.label = "Disconnect";
nc = new NetConnection();
nc.client = this;
nc.addEventListener(NetStatusEvent.NET_STATUS, onConnect);
nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncError);
nc.connect("rtmp://10.117.90.248/oflaDemo/mainRoom");
}
else
{
conButton.label = "Connect";
nc.close();
}
}
protected function onConnect(event:NetStatusEvent):void
{
if(event.info.code == "NetConnection.Connect.Success")
{
//carry rest of processsing
}
else if (event.info.code == "NetConnection.Connect.Rejected")
{
trace(event.info.code);
trace(event.info.description);
}
}
지금 내 문제는 내가
이 NetConnection.connect를 얻기에 빈 문자열을 얻고 있다는 점이다. Flex에서을 거부하십시오.
설명을 얻지 못하는 특별한 이유가 있습니까? 나는 의도적으로 어떤 주장도하지 않고있다.
저는 다음을 사용하고 있습니다 : - Red5 - 1.0.0 - RC2.
플렉스 4.6
내가 추가 한
============= 업데이트 ==============
추적 (ObjectUtil.toString (event))
this 답변으로 언급 됨. 다음과 같이 표시됩니다.
info = (Array)#3947
[application] (null)
[code] "NetConnection.Connect.Rejected"
[description] ""
[level] "error"
[objectEncoding] 3
target = (flash.net::NetConnection)#1
type = "netStatus"
Flex 클라이언트 코드를 추가했습니다. 희망이 있습니다. – GoldRoger
rejectClient는 [주어진 이름으로 반환하지 않습니다] (https://code.google.com/p/red5/source/browse/java/server/trunk/src/main/java/org/red5/server/adapter) /MultiThreadedApplicationAdapter.java#sl_svn4764_266) – GoldRoger