|
Home > Archive > Macromedia Flash Server > April 2005 > onDisconnect and Remoting
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
onDisconnect and Remoting
|
|
| Brook Davies 2005-04-07, 5:49 pm |
| Hello,
I'm working on an app that uses flashcom to support chat between active
users of the application. I'm using CFMX and FCS together. When a user logs
in via Flash Remoting the're name is added the DB as an active user. When
they log out, they are removed from this table.
I am trying to use the application.onDisconnect to call a CFC to remove
the user from the active users table. The thing is, the onDisconnect method
ALWAYS runs, but the remoting call does not always run. I can tell that it
does not run because a) the user is NOT removed from the table, and the
trace in the result handler does not run.
It I reload the app in between each test, it works and the remoting call
succeeds. However, if I do not reload the app, the remoting call fails. Can
anyone see why from this slighlty simplified code below??
application.onAppStart = function()
{
trace('Connecting to CFMX');
// connnect to CFMX / Set the default gateway URL
NetServices.setDefaultGatewayUrl("http://dev.mysite.com/flashservices/gateway");
// Connect to the gateway
this.gatewayConnnection = NetServices.createGatewayConnection();
this.userService =
this.gatewayConnnection.getService("components.user",application);
}
application.onDisconnect = function(client)
{
trace("disconnect: " + client.name);
this.userService.removeFromActiveUserDB(client.name,'true');
}
application.removeFromActiveUserDB_Result = function(result){
trace('Running removeFromActiveUserDB_result');
}
Thanks for your help, Im stuck!
Brook Davies
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| John Berzy 2005-04-07, 5:49 pm |
| Theres a bug with remoting and flashcom...... I've noticed that the first
call to the server works normally... then every subsequent call takes upto 5
minutes or doesn't work at all.... theres a tech note on macromedia.com for
that.
http://www.macromedia.com/cfusion/k...cfm?id=tn_18647
first you should check your webservers keep alive setting. It should be set
to "On" so that the client ("flashcom server") can keep a persistant
connection to flash remoting.
if that doesn't work their other workaround for it was to close the gateway
then recreate the service for every call (a little messy).
hope that helps.
JB
>From: Brook Davies <blists-hPGeiHfRdz/sBN0MCq728g@public.gmane.org>
>Reply-To: FlashComm Mailing List <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
>To: FlashComm Mailing List <flashcomm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org>
>Subject: [FlashComm] onDisconnect and Remoting
>Date: Sun, 20 Feb 2005 16:45:44 -0800
>
>Hello,
>
>I'm working on an app that uses flashcom to support chat between active
>users of the application. I'm using CFMX and FCS together. When a user logs
>in via Flash Remoting the're name is added the DB as an active user. When
>they log out, they are removed from this table.
>
>I am trying to use the application.onDisconnect to call a CFC to remove
>the user from the active users table. The thing is, the onDisconnect method
>ALWAYS runs, but the remoting call does not always run. I can tell that it
>does not run because a) the user is NOT removed from the table, and the
>trace in the result handler does not run.
>
>It I reload the app in between each test, it works and the remoting call
>succeeds. However, if I do not reload the app, the remoting call fails. Can
>anyone see why from this slighlty simplified code below??
>
>application.onAppStart = function()
>{
> trace('Connecting to CFMX');
> // connnect to CFMX / Set the default gateway URL
> NetServices.setDefaultGatewayUrl("http://dev.mysite.com/flashservices/gateway");
> // Connect to the gateway
> this.gatewayConnnection = NetServices.createGatewayConnection();
> this.userService =
>this.gatewayConnnection.getService("components.user",application);
>}
>
>
>application.onDisconnect = function(client)
>{
> trace("disconnect: " + client.name);
> this.userService.removeFromActiveUserDB(client.name,'true');
>}
>
>application.removeFromActiveUserDB_Result = function(result){
> trace('Running removeFromActiveUserDB_result');
>}
>
>Thanks for your help, Im stuck!
>
>Brook Davies
>
>
>
>=-----------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=-----------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Brian Lesser 2005-04-07, 5:49 pm |
| Yes, that was fixed in the 1.5.1 updater.
http://www.macromedia.com/support/f...151.html#issues
(See ID 49063)
Brook, are running on version 1.5.2?
Yours truly,
-Brian
John Berzy wrote:
> Theres a bug with remoting and flashcom...... I've noticed that the
> first call to the server works normally... then every subsequent call
> takes upto 5 minutes or doesn't work at all.... theres a tech note on
> macromedia.com for that.
>
> http://www.macromedia.com/cfusion/k...cfm?id=tn_18647
>
> first you should check your webservers keep alive setting. It should
> be set to "On" so that the client ("flashcom server") can keep a
> persistant connection to flash remoting.
>
> if that doesn't work their other workaround for it was to close the
> gateway then recreate the service for every call (a little messy).
>
> hope that helps.
>
> JB
>
>
>
>
>
>
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
--
________________________________________
______________________________
Brian Lesser
Assistant Director, Teaching and Technology Support
Computing and Communications Services
Ryerson University
350 Victoria St.
Toronto, Ontario Phone: (416) 979-5000 ext. 6835
M5B 2K3 Fax: (416) 979-5220
Office: AB48D E-mail: blesser-6s6ziW1YCwCw5LPnMra/2Q@public.gmane.org
(Enter through LB66) Web: http://www.ryerson.ca/~blesser
________________________________________
______________________________
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Brook Davies 2005-04-07, 5:49 pm |
| Thanks, it looks like I am using 1.5.1. I'll upgrade to 1.52.
At 08:50 AM 2/21/2005, you wrote:
>Yes, that was fixed in the 1.5.1 updater.
>http://www.macromedia.com/support/f...151.html#issues
>(See ID 49063)
>Brook, are running on version 1.5.2?
>Yours truly,
>-Brian
>
>
>John Berzy wrote:
>
>
>
>
>--
> ________________________________________
______________________________
>Brian Lesser
>Assistant Director, Teaching and Technology Support
>Computing and Communications Services
>Ryerson University
>350 Victoria St.
>Toronto, Ontario Phone: (416) 979-5000 ext. 6835
>M5B 2K3 Fax: (416) 979-5220
>Office: AB48D E-mail: blesser-6s6ziW1YCwCw5LPnMra/2Q@public.gmane.org
>(Enter through LB66) Web: http://www.ryerson.ca/~blesser
> ________________________________________
______________________________
>
>
>=-----------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=-----------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Brook Davies 2005-04-07, 5:49 pm |
| Upgrading Solved the problem, thanks!
At 10:57 AM 2/21/2005, you wrote:
>Thanks, it looks like I am using 1.5.1. I'll upgrade to 1.52.
>
>At 08:50 AM 2/21/2005, you wrote:
>
>
>
>=-----------------------------------------------------------
>Supported by Fig Leaf Software - http://www.figleaf.com
>=-----------------------------------------------------------
>
>To change your subscription options or search the archive:
>http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
|
| me too.
I posted to a few groups about my "5 minute problem" with no luck.
Seems 1.5 r2 solves this problem.
- Hours spent in vain, but at least it works now.
On Mon, 21 Feb 2005 11:10:32 -0800, Brook Davies
<blists-hPGeiHfRdz/sBN0MCq728g@public.gmane.org> wrote:
> Upgrading Solved the problem, thanks!
>
> At 10:57 AM 2/21/2005, you wrote:
>
> =-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =-----------------------------------------------------------
>
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
| |
| Michael Sasaki 2005-04-07, 5:49 pm |
| Hi All,
I am using the same methodology as Brook though receiving a different
error. I am using 1.5.2 and Flash Remoting with .NET direct to an
assembly. Though the problem does not seem to be with remoting but with
onDisconnect firing and not recognizing the user. I have an array of
current users on the FCS in order to call to events as needed to the
client. I manage this array using the onConnect and onDisconnect
events. The situation is on the client I have a connection loop which
go's through the ports at a setInterval rate. Some clients connect
multiple times and thus when my script disconnects from these "extra"
ports the onDisconnect does not recognize the user. My trace returns
"undefined" Below is a sample of the code. Any incite would be greatly
appreciated..
application.onAppStart =3D function(){
trace("Application starting: " + this.name);
=20
// Setup Our Connection Object
NetServices.setDefaultGatewayUrl(
"http://someserver/flashremoting/gateway.aspx" );
=09
// Open The Connection Object
this.gatewayConnection =3D
NetServices.createGatewayConnection();
=09
// Create Local Object To Call To Service
remotingServer =3D this.gatewayConnection.getService(
"FCSRemoting", this);
this.logRemotingServer =3D
this.gatewayConnection.getService( "FCSRemoting", this);
// Create Object Of Clients
this.users =3D new Array();
}
application.onConnect=3D function(newClient, userStats){
application.acceptConnection(newClient);
}
application.onConnectAccept =3D function( newClient, userStats ) {
=20
if(this.users[userStats.username] =3D=3D undefined || =
userStats.username
=3D=3D "guest"){
// No Connection Exist So Add User =09
// Add Client To Client Object
newClient.currentConnections =3D Number(1);
newClient.username =3D
userStats.username;
newClient.userid =3D
userStats.userid;
newClient.webcam =3D
userStats.camera;
newClient.level =3D
userStats.level;
newClient.port =3D
userStats.port;
newClient.fcsServerID =3D userStats.fcsServerID;
newClient.app =3D this;
=20
this.users[userStats.username] =3D newClient;
=09
// Make The Call To The DataBase Using Remoting
var clientID =3D
Number(userStats.userid);
var clientCamera =3D Boolean(userStats.camera);
var clientFCFarmID =3D Number(userStats.fcsServerID);
if(!userStats.chat && userStats.username !=3D "guest"){
remotingServer.setOnlineStatus(clientID,
clientCamera, clientFCFarmID);
} =09
}else{
// User Has Connection So Incrament
this.users[userStats.username].currentConnections++;
trace(userStats.username + " added a connection -> " +
this.users[userStats.username].username);
}
=20
trace(userStats.username + " connected from " + newClient.ip + ",
userid: " + userStats.userid + ", webcam: " + userStats.camera + ",
level: " + userStats.level + ", fcsServer " + userStats.fcsServerID + ",
FCS Port " + userStats.port + ", Register " + userStats.register + ",
LoadTime " + userStats.loadTime);
}
application.onDisconnect =3D function(client){
trace("User " + client.username + " Attempting To Disconnect ->
" + client.currentConnections)
=20
// Check To See If Client Has Other Connections
if(client.currentConnections > 1 && client.username !=3D "guest"){
// Drop Connections Counter By One
this.users[client.username].currentConnections--;
trace(client.username + " from " + client.ip + " lost a
connection from port " + client.port);
}else{
// Remove Client From Client Object
var clientID =3D Number(client.userid);
var clientFCFarmID =3D Number(client.fcsServerID);
// Check To See If This Was A Chat Request
if(!client.chat && client.username !=3D "guest" &&
client.username !=3D undefined){
// Was Not A Chat So Log Connection
remotingServer.setOfflineStatus( clientID,
clientFCFarmID );
}
=09
trace(client.username + " from " + client.ip + " disconnected
from port " + client.port);
delete this.users[client.username];
}
}
=20
-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org] On Behalf Of da5id
Sent: Monday, February 21, 2005 2:26 PM
To: FlashComm Mailing List
Subject: Re: [FlashComm] onDisconnect and Remoting
me too.
I posted to a few groups about my "5 minute problem" with no luck.
Seems 1.5 r2 solves this problem.
- Hours spent in vain, but at least it works now.
On Mon, 21 Feb 2005 11:10:32 -0800, Brook Davies
<blists-hPGeiHfRdz/sBN0MCq728g@public.gmane.org> wrote:
> Upgrading Solved the problem, thanks!
>=20
> At 10:57 AM 2/21/2005, you wrote:
[vbcol=seagreen]
> =
[vbcol=seagreen]
[vbcol=seagreen]
table.[vbcol=seagreen]
[vbcol=seagreen]
does not run.[vbcol=seagreen]
simplified code below??[vbcol=seagreen]
NetServices. createGatewayConnection();[vbcol=seagree
n]
http://www.ryerson.ca/~blesser[vbcol=seagreen]
>=20
> =3D-----------------------------------------------------------
> Supported by Fig Leaf Software - http://www.figleaf.com
> =3D-----------------------------------------------------------
>=20
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
=3D-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=3D-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
|
|
|
|
|