Sender is not a User Why?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

zynbasil
Posts: 35
Joined: 23 May 2016, 03:59

Sender is not a User Why?

Postby zynbasil » 06 Dec 2016, 06:37

HI:

when user reconnect:"Extension Request refused. Sender is not a User " why?

User login: { Zone: slots }, ( User Name: faecdcb4969b7f98023167dd89d46de3f6ed9dea, Id: 49916, Priv: 0, Sess: 172.31.46.150:56097 ) , Type: C++ API
06 Dec 2016 | 06:34:09,599 | WARN | com.smartfoxserver.v2.controllers.ExtensionController-872 | v2.controllers.ExtensionController | | com.smartfoxserver.v2.exceptions.SFSExtensionException: Extension Request refused. Sender is not a User: { Id: 117643, Type: DEFAULT, Logged: No, IP: 172.31.46.150:56095 }
User avatar
anhptoe
Posts: 16
Joined: 11 Nov 2016, 08:48
Location: Hanoi, Vietnam

Re: Sender is not a User Why?

Postby anhptoe » 06 Dec 2016, 07:54

zynbasil wrote: { Id: 117643, Type: DEFAULT, Logged: No, IP: 172.31.46.150:56095 }

Not logged in. It's still a session, not an user yet.
User avatar
Lapo
Site Admin
Posts: 21090
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Sender is not a User Why?

Postby Lapo » 06 Dec 2016, 09:00

As anhptoe said, this indicates that your client code is sending requests prior to having logged in or, alternatively, after a LOGIN_ERROR. In either case a client is not allowed to send requests if he's not successfully logged in.

Make sure to double check your client code for those two states.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
zynbasil
Posts: 35
Joined: 23 May 2016, 03:59

Re: Sender is not a User Why?

Postby zynbasil » 06 Dec 2016, 15:01

Thanks~
zynbasil
Posts: 35
Joined: 23 May 2016, 03:59

Re: Sender is not a User Why?

Postby zynbasil » 07 Dec 2016, 07:11

Lapo wrote:As anhptoe said, this indicates that your client code is sending requests prior to having logged in or, alternatively, after a LOGIN_ERROR. In either case a client is not allowed to send requests if he's not successfully logged in.

Make sure to double check your client code for those two states.

Thanks


How client know it self logged in ? With some API?

case:
1.client lost connect
2.client reconnect
3.server session exist ->remove session ->sender is not a user
4.client lost connect
User avatar
anhptoe
Posts: 16
Joined: 11 Nov 2016, 08:48
Location: Hanoi, Vietnam

Re: Sender is not a User Why?

Postby anhptoe » 13 Dec 2016, 08:36

zynbasil wrote:.

In client, add a log listener:

Code: Select all

smartFox.AddLogListener(LogLevel.DEBUG, OnDebugMessage);


And add this function to show log:

Code: Select all

private static void OnDebugMessage(BaseEvent evt) {
   string message = (string)evt.Params["message"];
   Debug.Log("[SFS DEBUG] " + message);
}

private static void OnDebugMessage(string message) {
   Debug.Log("[SFS DEBUG] " + message);
}
User avatar
Lapo
Site Admin
Posts: 21090
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Sender is not a User Why?

Postby Lapo » 13 Dec 2016, 09:29

zynbasil wrote:How client know it self logged in ? With some API?

The client is logged in after having sent a LoginRequest and received the relative server response.

Before you can interact with the server you need to perform two steps:
1- Connect
2- Login

After these two steps are completed you can send any request. Your game/app interface should not show any buttons that trigger server requests until the login is completed successfully.

If this is still not entirely clear to you, I would highly recommend that you download our Example packs from here:
http://smartfoxserver.com/download/sfs2x#p=examples

In there you will find simple client examples that show you every step. Tutorials are available here:
http://docs2x.smartfoxserver.com/

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
FireSmartFox
Posts: 29
Joined: 28 Sep 2018, 19:47

Re: Sender is not a User Why?

Postby FireSmartFox » 21 Mar 2019, 00:05

I have the same problem.
Lapo wrote:
Before you can interact with the server you need to perform two steps:
1- Connect
2- Login


So if I check "sfs.isConnected==true" before submitting a request it wouldn't be enough, right? What do you recommend to check if the login is currently valid?
User avatar
Lapo
Site Admin
Posts: 21090
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Sender is not a User Why?

Postby Lapo » 21 Mar 2019, 10:41

Hi,
the connection only establishes a channel of communication, but you need to be logged into a Zone to start sending any request.

Check this basic tutorial for more, if needed:
http://docs2x.smartfoxserver.com/Develo ... ogin-phase

So all you need to do is send the LoginRequest (after the connection is successful) and handle the two related events: SFSEvent.LOGIN and SFSEvent.LOGIN_ERROR

If you logged in successfully you can start sending requests, otherwise you will need to signal the error to the client and let him retry.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 12 guests