The requirement for authentication of event subscribers in ServiceStack -


my client-server application uses servereventsfeature send commands client server. in client use servereventsclient , start method subscribe events, first i'm sending authentication request server using servereventsclient.serviceclient , send method.

my client needs connect server if connection broken. use onexception action property of servereventsclient, , when connection breaks, call stop method in cycle , try again send authentication request until server responds.

it works well, if restart server, before client has time send authentication request, see on server subscribe events (onconnect, onsubscribe, , on), , when checking properties of subscription, strange values isauthenticated: false, userid: -2. comes authentication request, , again there expected subscribe events, , time, property values expected isauthenticated: true, userid: 46. sessionid in first case differs value before disconnected, not match value after authentication. in onconnect event handler tried check isauthenticated property , call unsubscribe method of object ieventsubscription, after still occurs onsubscribe event. have 2 questions:

q1: servereventsclient automatically tries reconnect after breakup. in case, stop method not triggered because client cannot perform unsubscribe request, because server not available. how stop process when unavailable server?

q2: can prevent event subscription not authorized clients?

the server events clients send heartbeats determine when automatically try reconnect after detects broken connection. can stop heartbeats removing heartbeaturl returned client, e.g:

plugins.add(new servereventsfeature {     onconnect = (sub, clientinfo) => clientinfo.remove("heartbeaturl") }); 

you can limit server events allow authenticated users with:

plugins.add(new servereventsfeature {     limittoauthenticatedusers = true, }); 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -