-
Notifications
You must be signed in to change notification settings - Fork 422
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
How to implement stream resumption in XEP-0198 stream management from client side ? #4220
Comments
the provided information is insufficient to make any suggestions. If you want further assistance, you must provide a config file and the dump of the XMMP traffic (all of the messages). don't forget to obfuscate all the secrets and passwords. also here is an example of stream resumption from our integration tests, you can use it as a reference |
my config file 👇 , stream management module is enabled by [general]
loglevel = "all"
hosts = ["<domain name is here>","localhost"]
host_types = []
default_server_domain = "localhost"
registration_timeout = "infinity"
language = "en"
max_fsm_queue = 1000
[[listen.http]]
port = 5280
transport.num_acceptors = 10
transport.max_connections = 1024
[[listen.http.handlers.mod_bosh]]
host = "_"
path = "/http-bind"
[[listen.http.handlers.mod_websockets]]
host = "_"
path = "/ws-xmpp"
timeout = "infinity"
#ping_rate = 30_000
c2s_state_timeout = "infinity"
[[listen.http]]
port = 5285
transport.num_acceptors = 10
transport.max_connections = 1024
tls.verify_mode = "none"
tls.certfile = "/etc/letsencrypt/live/<domain name>/fullchain.pem"
tls.keyfile = "/etc/letsencrypt/live/<domain name>/privkey.pem"
[[listen.http.handlers.mod_bosh]]
host = "_"
path = "/http-bind"
[[listen.http.handlers.mod_websockets]]
host = "_"
path = "/ws-xmpp"
#ping_rate = 30_000
c2s_state_timeout = "infinity"
[[listen.http]]
ip_address = "0.0.0.0"
port = 8088
transport.num_acceptors = 10
transport.max_connections = 1024
[[listen.http.handlers.mongoose_admin_api]]
host = "_"
path = "/api"
username = "admin"
password = "secret"
[[listen.http]]
port = 8089
transport.num_acceptors = 10
transport.max_connections = 1024
protocol.compress = true
tls.verify_mode = "none"
tls.certfile = "priv/ssl/fake_cert.pem"
tls.keyfile = "priv/ssl/fake_key.pem"
tls.password = ""
[[listen.http.handlers.mongoose_client_api]]
host = "_"
path = "/api"
[[listen.http]]
ip_address = "127.0.0.1"
port = 5551
transport.num_acceptors = 10
transport.max_connections = 1024
[[listen.http.handlers.mongoose_graphql_handler]]
host = "localhost"
path = "/api/graphql"
schema_endpoint = "admin"
username = "admin"
password = "secret"
[[listen.http]]
ip_address = "0.0.0.0"
port = 5541
transport.num_acceptors = 10
transport.max_connections = 1024
[[listen.http.handlers.mongoose_graphql_handler]]
host = "_"
path = "/api/graphql"
schema_endpoint = "domain_admin"
[[listen.http]]
ip_address = "0.0.0.0"
port = 5561
transport.num_acceptors = 10
transport.max_connections = 1024
[[listen.http.handlers.mongoose_graphql_handler]]
host = "_"
path = "/api/graphql"
schema_endpoint = "user"
[[listen.c2s]]
port = 5222
access = "c2s"
shaper = "c2s_shaper"
max_stanza_size = 65536
tls.verify_mode = "none"
tls.certfile = "priv/ssl/fake_server.pem"
[[listen.s2s]]
port = 5269
shaper = "s2s_shaper"
max_stanza_size = 131072
[[listen.service]]
port = 8888
access = "all"
shaper_rule = "fast"
ip_address = "127.0.0.1"
password = "secret"
[auth]
methods = ["rdbms"]
[auth.rdbms]
[outgoing_pools.rdbms.default]
scope = "global"
workers = 5
[outgoing_pools.rdbms.default.connection]
driver = "mysql"
host = "localhost"
database = "mongooseim"
username = "root"
password = "password"
[outgoing_pools.http.mongoose_push_http]
scope = "global"
strategy = "available_worker"
[outgoing_pools.http.mongoose_push_http.connection]
host = "https://localhost:8443"
tls.verify_mode = "none"
[services.service_admin_extra]
[services.service_mongoose_system_metrics]
[modules.mod_ping]
[modules.mod_offline]
access_max_user_messages = "max_user_offline_messages"
backend = "mnesia"
[modules.mod_pubsub]
plugins = ["push"] # mandatory minimal config
[modules.mod_event_pusher.push]
backend = "mnesia" # optional
wpool.workers = 200 # optional
plugin_module = "mod_event_pusher_push_plugin_enhanced" # optional
virtual_pubsub_hosts = ["pubsub.@HOST@"]
[modules.mod_push_service_mongoosepush]
pool_name = "mongoose_push_http"
api_version = "v3"
[modules.mod_adhoc]
[modules.mod_disco]
extra_domains = ["<domain name here>"]
users_can_see_hidden_services = false
[modules.mod_stream_management]
[modules.mod_register]
ip_access = [
{address = "127.0.0.0/8", policy = "allow"},
{address = "0.0.0.0/0", policy = "deny"}
]
access = "register"
[modules.mod_presence]
[modules.mod_sic]
[modules.mod_vcard]
host = "vjud.@HOST@"
[modules.mod_bosh]
[modules.mod_carboncopy]
[shaper.normal]
max_rate = 1000
[shaper.fast]
max_rate = 50_000
[shaper.mam_shaper]
max_rate = 1
[shaper.mam_global_shaper]
max_rate = 1000
[acl]
local = [{}]
[access]
max_user_sessions = [
{acl = "all", value = 10}
]
max_user_offline_messages = [
{acl = "admin", value = 5000},
{acl = "all", value = 100}
]
local = [
{acl = "local", value = "allow"}
]
c2s = [
{acl = "blocked", value = "deny"},
{acl = "all", value = "allow"}
]
c2s_shaper = [
{acl = "admin", value = "none"},
{acl = "all", value = "normal"}
]
s2s_shaper = [
{acl = "all", value = "fast"}
]
muc_admin = [
{acl = "admin", value = "allow"}
]
muc_create = [
{acl = "local", value = "allow"}
]
muc = [
{acl = "all", value = "allow"}
]
register = [
{acl = "all", value = "allow"}
]
mam_set_prefs = [
{acl = "all", value = "default"}
]
mam_get_prefs = [
{acl = "all", value = "default"}
]
mam_lookup_messages = [
{acl = "all", value = "default"}
]
mam_set_prefs_shaper = [
{acl = "all", value = "mam_shaper"}
]
mam_get_prefs_shaper = [
{acl = "all", value = "mam_shaper"}
]
mam_lookup_messages_shaper = [
{acl = "all", value = "mam_shaper"}
]
mam_set_prefs_global_shaper = [
{acl = "all", value = "mam_global_shaper"}
]
mam_get_prefs_global_shaper = [
{acl = "all", value = "mam_global_shaper"}
]
mam_lookup_messages_global_shaper = [
{acl = "all", value = "mam_global_shaper"}
]
[s2s]
use_starttls = "optional"
certfile = "priv/ssl/fake_server.pem"
default_policy = "deny"
outgoing.port = 5269
#[[host_config]]
# host = "anonymous.localhost"
#
# [host_config.auth.anonymous]
# allow_multiple_connections = true
# protocol = "both"
Client side xmpp traffic 👇
<open to="<domain name here>" version="1.0" xmlns="urn:ietf:params:xml:ns:xmpp-framing"/>
<open xml:lang='en' version='1.0' xmlns='urn:ietf:params:xml:ns:xmpp-framing' id='dc7ecf662d9a696c' from='<domain name here>'/>
<features
xmlns='http://etherx.jabber.org/streams'>
<starttls
xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
<register
xmlns='http://jabber.org/features/iq-register'/>
<sm
xmlns='urn:xmpp:sm:3'/>
<mechanisms
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>SCRAM-SHA-512</mechanism>
<mechanism>SCRAM-SHA-384</mechanism>
<mechanism>SCRAM-SHA-256</mechanism>
<mechanism>SCRAM-SHA-224</mechanism>
<mechanism>SCRAM-SHA-1</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
</features>
<auth mechanism="SCRAM-SHA-1"
xmlns="urn:ietf:params:xml:ns:xmpp-sasl">biwsbj0rOTE5MjA3MjQ4NjY0LHI9M2M4NDFhYTM1NDVkYTUyNWE3YmMwNjA0NWNjNDYyZDI=
</auth>
<challenge
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cj0zYzg0MWFhMzU0NWRhNTI1YTdiYzA2MDQ1Y2M0NjJkMjN5MEtZTGJuMVB4TTdEdTg1VmEra1E9PSxzPXREY2VLNTE1Y25QY2VobllOQllrQWc9PSxpPTEwMDAw
</challenge>
<response
xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Yz1iaXdzLHI9M2M4NDFhYTM1NDVkYTUyNWE3YmMwNjA0NWNjNDYyZDIzeTBLWUxibjFQeE03RHU4NVZhK2tRPT0scD14ZzJBa1dLN0ZzbllMbHA5cmN6SEwwRW5RbXc9
</response>
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dj1pSE1BcFBVYmV3NWpNQTd0dXFiWnB0RE9pYVE9</success>
<open to="domain name here" version="1.0" xmlns="urn:ietf:params:xml:ns:xmpp-framing"/>
<open xml:lang='en' version='1.0' xmlns='urn:ietf:params:xml:ns:xmpp-framing' id='035fe37c437c9543' from='domain name here'/>
<features
xmlns='http://etherx.jabber.org/streams'>
<session
xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
<bind
xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
<register
xmlns='http://jabber.org/features/iq-register'/>
<sm
xmlns='urn:xmpp:sm:3'/>
</features>
<iq id="_bind_auth_2" type="set"
xmlns="jabber:client">
<bind
xmlns="urn:ietf:params:xml:ns:xmpp-bind">
<resource>mobile</resource>
</bind>
</iq>
<iq id='_bind_auth_2' type='result'
xmlns='jabber:client'>
<bind
xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>jid here/mobile</jid>
</bind>
</iq>
<iq id="_session_auth_2" type="set"
xmlns="jabber:client">
<session
xmlns="urn:ietf:params:xml:ns:xmpp-session"/>
</iq>
<iq from='domain name here' to='jid here/mobile' id='_session_auth_2' type='result'
xmlns='jabber:client'>
<session
xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</iq>
<resume h="57" previd="qtsPBR8Dl9mIgDOI2g3R1y17c/tz" xmlns="urn:xmpp:sm:3"/>
<failed xmlns='urn:xmpp:sm:3'><unexpected-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></failed> Do note that Is it possible the |
hi @DenysGonchar , it was indeed because of trying to bind the resource again, i am successfully getting <presence from='my jid here' to='my jid here, same as from' type='unavailable'
xmlns='jabber:client'>
<status>Unknown condition</status>
</presence> |
one more time, we need the full traffic to make any suggestions. |
@DenysGonchar here is the logs from client 👇
here is the logs from mongooseim in server 👇
|
We are looking into the issue. Currently, we are expanding our tests, to cover the scenario described above. This may take some time, because firstly we need to make some changes to our XMPP websocket client used for tests, to make it support stream management. The necessary tasks were already added to our backlog. We will inform you when we solve the problem or find the solution. |
@JanuszJakubiec , thanks, much appreciated |
MongooseIM version: 6.1.1
Installed from: pkg
Erlang/OTP version: 26
i am trying to implement stream resumption feature from xep 0198 but i am getting
<failed xmlns='urn:xmpp:sm:3'><unexpected-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></failed>
after sending the<resume/>
stanza. I am using strophe.js client and have enabled mod_ping in mongooseim to detect broken connections. After the connectiion is reestablished after lossing connection, i am reconnecting using strophe.js's connect method, and then then sending<resume h="<current h value>" previd="<previous-id>" xmlns="urn:xmpp:sm:3"/>
, but in response i am getting the<failed xmlns='urn:xmpp:sm:3'><unexpected-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></failed>
responseThe text was updated successfully, but these errors were encountered: