New Posts New Posts RSS Feed: SignalR
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

SignalR

 Post Reply Post Reply Page  <12
Author
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Topic: SignalR
    Posted: 30-Oct-2013 at 9:13am
kdev, 

Executing a query fixes the issue - the client is silently logged back in using the information in the 'session bundle'. In this case, the sessionKey remains the same.

I tested calling a query before suggesting it to you and it worked fine. You can check my test solution here uploads/892/SignalR.zip
Note that since you stated this is a DevForce/SignalR issue, I removed Cocktail as it is not pertinent to the problem and only adds unnecessary complexity.

As for logging back in, you'd need the user to enter the credentials again. You are correct about not knowing if the session has timed out on the client side - specially because if a query/save is performed, the silent login occurs.
Unless you want to implement some monitoring on the client that would require a manual login after a certain amount of time (time that would match the sessionTimeout in web.config), the easiest approach is to use the silent login by running a dummy query.

Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 30-Oct-2013 at 9:29am
I tried your solution and it also has the issue :




Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 30-Oct-2013 at 9:34am
Interesting.

I'll check why it works here, but not there.
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 30-Oct-2013 at 9:50am
I should note it didn't throw the exception on the first timeout but the second.

Here is what I did :

- Click the button
- Wait more than 1 minute 
- Click the button
 => Success
- Wait more than 1 minute 
- Click the button
 => Fail
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 30-Oct-2013 at 2:14pm
Thanks for the additional information.
That certainly helped.

The problem is that the same query executed a second time tend to run against the cache.
To solve the problem set the query to explicitly run against the DataSource:

i.e. 

await dummyQuery.With(QueryStrategy.DataSourceOnly).ExecuteAsync();
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 19-Nov-2013 at 9:48am
Running the dummy query on the original EmtityManager works but I would like to be able to reconnect with another EntityManager.

why ? because I find  to have to execute a query dummy before every call very annoying so I want to encapsulate the Invoke method frrom the SignalR.IHubProxy with this query call inside.

if I create a new EntityManager with the same ConnectionOption (cocktail) as the EntityManager I used to login in the application it doesn't work although they have the same sessionKey !

I noticed if I create an entityManager from the disconnected EntityManager it works (with new EntityManager(em)).
but if I create it from an EntityManagerContext using the same values as the one in the disconnected em it doesn't.

                var context = new EntityManagerContext(
                    dataSourceExtension : disconnectedEm.DataSourceExtension,
                    entityServiceOption: disconnectedEm.EntityServiceOption,
                    compositionContextName: disconnectedEm.CompositionContext.Name,
                    options: disconnectedEm.Options,
                    serviceKey: disconnectedEm.ServiceKey);

I don't really understand why in some case it works and not in others. what is the use of the sessionkey if a newly entitymanager using the same sessionkey of the disconnected one doesn't do the job.

is it possible to achieve my scenario with cocktail ?





Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 20-Nov-2013 at 2:38am
I have a case where a ViewModel has no UnitOfwork or EntityManager at all, but I am doing SignalR call providing the Authenticationcontext.SessionKey as the signalr method will create entities with Audit information.

How, in this case, can I reconnect "something" with a dummy query without any EntityManager ? Is there a way to create a new EntityManager (with which parameters) which will allow the reconnection ?


Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 20-Nov-2013 at 6:45am
Edit : repost of the post due to a delete by error


This SessionKey issue  is making me crazy !

When I implement the Dummy Query in my application it doesn't work at all, I still get the "Relogin error" while it does in the test project.

I updated my first project test to implement IEntityManagerProvider<T> from Cocktail and it appears the relogin process doesn't happen completly when I use the manager coming from this service.
To resume, prior to the Invoke code I don't get the same result depending of the way the entitymanager been created. Exemple :

    // THIS VERSION WORKS
    var _em = new EntityManager();
    var orders = await new EntityQuery<Order>().With(_em).With(QueryStrategy.DataSourceOnly).ExecuteAsync();
            
    // THIS VERSION DOESN'T WORK
    var orders = await new EntityQuery<Order>().With(_entityManagerProvider.Manager).With(QueryStrategy.DataSourceOnly).ExecuteAsync();

Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 25-Nov-2013 at 5:58am
Any info/idea ?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 26-Nov-2013 at 9:55am
kdev.

I'm checking what in Cocktail could be causing this behavior.
I'll follow up shortly.
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 02-Dec-2013 at 6:41am
Hi,

Any news ?

Regards,
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 02-Dec-2013 at 5:39pm
kdev,

You are using compositionContext, so you must specify what context you are using when you login:

        var loginOptions = new LoginOptions(compositionContextName: "SignalRDefault");
        var em = new EntityManager();
        em.AuthenticationContext = Authenticator.Instance.Login(sessionKey, loginOptions);
Back to Top
kdev View Drop Down
Groupie
Groupie
Avatar

Joined: 03-Jan-2013
Posts: 83
Post Options Post Options   Quote kdev Quote  Post ReplyReply Direct Link To This Post Posted: 04-Dec-2013 at 10:07am
Worked thank you
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down