#1 2015-05-24 16:23:48

hkcity1111
Member
Registered: 2014-08-18
Posts: 14

Retrieve session id if using sicPerSession in interface based service

Hi all,

I found that there will be a field called "id" returned ( 786998398 in the following json sample) in json if using sicPerSession in calling interface interface based service.
As I want to keep track of user behavior, Can I retrieve session id like "id" within calling interface based service such as in the area of
ServiceContext.Request.Call.InHead?

Thanks for your advice.

Regards,
  Kenneth

JSON example
e.g

{
	"result" : {
		"success" : true,
		"msg" : "",
		"data" : []
	},
	"id" : 786998398
}

Last edited by hkcity1111 (2015-05-24 16:24:43)

Offline

#2 2015-05-24 17:35:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: Retrieve session id if using sicPerSession in interface based service

See in the ServiceContext treadvar itself: it has a ServiceContext.Request field which has anything you need.
For instance, the Session property, but others:

    /// the corresponding session TAuthSession.IDCardinal value
    // - equals 0 (CONST_AUTHENTICATION_SESSION_NOT_STARTED) if the session
    // is not started yet - i.e. if still in handshaking phase
    // - equals 1 (CONST_AUTHENTICATION_NOT_USED) if authentication mode
    // is not enabled - i.e. if TSQLRestServer.HandleAuthentication = FALSE
    Session: cardinal;
    /// the corresponding TAuthSession.User.GroupRights.ID value
    // - is undefined if Session is 0 or 1 (no authentication running)
    SessionGroup: integer;
    /// the corresponding TAuthSession.User.ID value
    // - is undefined if Session is 0 or 1 (no authentication running)
    SessionUser: TID;
    /// the corresponding TAuthSession.User.LogonName value
    // - is undefined if Session is 0 or 1 (no authentication running)
    SessionUserName: RawUTF8;
    /// the remote IP from which the TAuthSession was created, if any
    // - is undefined if Session is 0 or 1 (no authentication running)
    SessionRemoteIP: RawUTF8;

Offline

#3 2015-05-25 03:49:09

hkcity1111
Member
Registered: 2014-08-18
Posts: 14

Re: Retrieve session id if using sicPerSession in interface based service

Thanks for your prompt reply.
It is very helpful.

Offline

Board footer

Powered by FluxBB