Skip to content

AMF Login DuplicateSessionDetected #1239

@radubirsan

Description

@radubirsan

I am trying to create a proof of concept that will maybe get me a job in porting a AIR/Flex project. Trying to login to the server gives a Duplicate Session error. Here is the Royale code:

<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:mx="library://ns.apache.org/royale/mx"
                   width="600" height="400" initialize="setUp()" >
	<fx:Script>
		<![CDATA[
			import mx.rpc.AsyncToken;
            import mx.rpc.Responder;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
			import mx.messaging.ChannelSet;
            import mx.messaging.channels.SecureAMFChannel;
            import mx.messaging.RoyaleClient;
            import mx.utils.UIDUtil;

			public var serverSTUB:String = "https://3cserver.3cnecectlab.net:9443"
			public function setUp():void
			{    
             var amfChannel:SecureAMFChannel = new SecureAMFChannel("my-secure-amf",serverSTUB + "/RiaService" + "/messagebroker/amflongpolling");
                amfChannel.requestTimeout = 10;
                channel.heartbeatInterval = 30000;
                RoyaleClient.getInstance().id = UIDUtil.createUID()//Math.round(Math.random())+ "9AB13FB-B51D-48F8-9EC9-2E06EC061EB5";
                channel.addChannel(amfChannel);  
			}
            public function login(e:MouseEvent=null):void{
                var r:Responder = new Responder(handleAuthenticateSuccess, handleLoginFault);
                var token:AsyncToken = channel.login('RBIRSAN', "Un1verge3Cst2020@");
                token.addResponder(r);
                trace("the token: ", token);  
            }
			private function handleAuthenticateSuccess(event:ResultEvent = null, token:Object = null):void
			{
				btn.label =  event.toString()	
			}
			
			private function handleLoginFault(event:FaultEvent = null, token:Object = null):void
			{
                btn.label =  event.toString()		
			}
		]]>
	</fx:Script>
	 <fx:Declarations>
         <mx:ChannelSet id="channel">
         </mx:ChannelSet>      
    </fx:Declarations>
 <mx:Button label="RemoteObject AMF Test" click="login(event)" id='btn'/>   
</mx:Application>

Here is my asconfig:

{
	"compilerOptions": {
		"targets": [
			"JSRoyale"
		],
		"source-path": [
			"src"
		]
	},
    "additionalOptions": "+configname=flex",
	"mainClass": "Main"
}

I am starting chrome like this bypass CORS errors:
chrome.exe --user-data-dir="C://chrome-dev-disabled-security" --disable-web-security --disable-site-isolation-trials

I get this response:
Duplicate HTTP-based FlexSession error: A request for FlexClient '585E2208-67F8-C428-0452-65840DD101A8' arrived over a new FlexSession 'ECD144ED710A291AE3E5C1D17560B501', but FlexClient is already associated with FlexSession '42A03B06B6FA9FED2AC03F7B3E14DB73', therefore it cannot be associated with the new session.

Loging at network trafic I see 3 requests all with diferent JSSESSIONID:
image

Any help in solving this is much appreciated, thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions