I’m not able to get the OnNeedLogin to work with TROJSONMessage in Delphi. It works fine with TROBinMessage (same client and server just switching message class).
Is this a known problem?
Version 9.5.111.1399
Hi,
Nobody reports about this issue.
can you check that you have address ending with json like to http://localhost:8099/json ?
can you create a simple testcase that reproduced this issue, pls?
you can attach it here or drop email to support@ if you want to keep it privately
Everything is working fine regarding functionality. But I couldn’t get OnLoginNeeded to work, so I switched to the Binary message. There OnLoginNeed works. I can continue without OnLoginNeeded, but it’s much more convenient to use it in case of disconnections and server side time out.
I have browsed the source code and I see that the the Binary message ends in a EROSessionNotFound exception (which is handled in TROTransportChannel.Dispatch), but the Json message doesn’t.
Thanks that worked.
Just a small explanation what happened here:
When a client without a corresponding session (AKA non-logged user) tries to call a service method that requires client to be authenticated the service raises a special SessionNotFound
exception.
After receiving this exception as a service method call the client channel knows that server requires authentication and raises the OnLoginNeeded
event.
This is how this works for the Binary message.
Unfortunately the JSON message with default settings doesn’t provide information about exact type of the exception happened server-side. So the client channel cannot determine if it should raise the OnLoginNeeded
event.
Enabling the SendExtendedException
option allows the server to send additional exception information (including the type info) to the client, so the client channel can raise the OnLoginNeeded
event when needed.
I understand, but I’m wondering why you really need SendExtendedException property at all. Couldn’t that be the default behaviour without the property? I guess it’s about backward compatibility. But I’ve decided to turn it on our server, and I can’t see why the extra information in the JSON object could harm any clients. Except that the error.name will be different.
Hi,
JSON standard doesn’t send error type.
so adding it can be a breaking change.
we will review possibility to use meta
tag for this purposes
from next public build, the OnLoginNeeded
event doesn’t require setting the SendExtendedException
property.