Hi Martin,
In the old version you can delete the exception from _TimeoutContext (it
should work as long the destination you are using to push does not define
security constraints)
"The reason is obvious: you cannot send a message to a client that has timed
out" -> Actually you are not doing that. You are broadcasting (pushing) a
message back to the clients and even if the current client is disconnecting
you must be able to do that (so the exception is a bug)
In the new version this was moved out from the context classes.
However if you have -secured- destinations a security error may still happen
depending which object's time out are you listening for:
- in the case of IClient destroyed event you would need per client
authentication configured (so when the client times out FluorineFx can
restore the correct security context)
- in the case of ISession destroyed event you would need per session
authentication configured (so when the session times out FluorineFx can
restore the correct security context)
- in the case of IMessageClient destroyed event both configurations should
work (you possibly do not need to listen for MessageClient events)
This is because when the time out happens on a server thread that thread
does not have configured any security context (it was started by the ASP.NET
runtime without any client request)
Then your code routes a new message through the Message Broker, and the
broker will try to perform security checks (if applicable)
Zoli
-----Original Message-----
From:
fluorine-bounces@...
[mailto:
fluorine-bounces@...] On Behalf Of Martin
Wickman
Sent: Sunday, April 19, 2009 5:27 PM
To:
fluorine@...
Subject: [Fluorine] NotImplementedException during RouteMessage
Hello
When a client disconnects from the server, that is, when the client closes
the browser/tab and the time out eventually occurs, I wanted to broadcast
that event to all other clients telling them that this client is not longer
there. I implemented this as listening on SessionCreated/SessionDestroyed
events. It seemed as straightforward as doing this in the SessionDestroyed
handler:
// In my service constructor:
ClientManager.AddSessionCreatedListener(this);
// In my listener class:
public void SessionCreated(IClient client)
{
client.AddSessionDestroyedListener(this);
}
public void SessionDestroyed(IClient client)
{
broadcastStatus(); // Throws exception!
client.RemoveSessionDestroyedListener(this);
}
The broadcastStatus() method sends an AsyncMessage to the destination as
usual. But the problem is that I get a NotImplementedException from the
FluorineFx.Context._TimeoutContext when I call messageBroker.RouteMessage.
See stack trace below. The reason is obvious: you cannot send a message to a
client that has timed out.
So how can I get around this, i.e. how can I send a message to the other
clients that still are connected?
This seems like it could be a race condition and could possibly occur if
unlucky.
NotImplementedException "The method or operation is not implemented."
at FluorineFx.Context._TimeoutContext.RestorePrincipal(ILoginCommand
loginCommand)
at FluorineFx.Messaging.MessageBroker.RouteMessage(IMessage message,
IEndpoint endpoint)
at FluorineFx.Messaging.MessageBroker.RouteMessage(IMessage message)
at ServiceLibrary.TreeLock.broadcastLockingStatus() in ...
at ServiceLibrary.TreeService.SessionDestroyed(IClient client) in ...
at FluorineFx.Messaging.Client.Disconnect(Boolean timeout)
at FluorineFx.Messaging.Client.Timeout()
at FluorineFx.Messaging.ClientManager.RemovedCallback(String key, Object
value, CacheItemRemovedReason callbackReason)
/Cheers
Martin
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com