-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow modifying c2s session info #3532
base: master
Are you sure you want to change the base?
feat: allow modifying c2s session info #3532
Conversation
What is the advantage of adding this hook as opposed to listening on the "sm_register_connection_hook" and calling "ejabberd_sm:set_user_info"? What's the specific use case you're trying to solve? |
@slezakattack My custom use case is that I can (parse our custom resource and) put user-agent, device unique id, device push notification id, etc in |
@slezakattack I also wanted to know that are you okay with changing Erlang/OTP 23 [erts-11.0] [source] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1] [hipe]
Eshell V11.0 (abort with ^G)
1> P = [{ip, {127,0,0,1}}, {conn, c2s}, {auth_module, ejabberd_auth_jwt}].
[{ip,{127,0,0,1}},{conn,c2s},{auth_module,ejabberd_auth_jwt}]
2> M = maps:from_list(P).
#{auth_module => ejabberd_auth_jwt,conn => c2s,ip => {127,0,0,1}}
% Returns the size of Term in actual heap words. Shared subterms are counted once.
3> erts_debug:size(P).
20
4> erts_debug:size(M).
15
5> RetryCount = lists:seq(1, 100000),ok.
ok
% I lookup 'conn' which is in the middle of list:
6> timer:tc(fun() -> lists:foreach(fun(_) -> proplists:get_value(conn, P) end, RetryCount) end).
{66721,ok}
7> timer:tc(fun() -> lists:foreach(fun(_) -> maps:get(conn, M) end, RetryCount) end).
{64413,ok} Also |
Adding those things to the |
@weiss |
I don't have a strong opinion on which datatype to use but I think migrating to a different datatype will incur migration costs to those who want to upgrade their ejabberd servers. I'm not sure if a 3% speed improvement is worth that cost but I'm not on the ejabberd team, just a member of the community. Just my two cents. |
@slezakattack Good point. It can be backward compatible for some times. |
ping |
No description provided.