<div dir="ltr"><div><div><div><div><div>I tried the example with directly connection to 5222 and the performance improved vastly.<br><br></div>I am running into another issue now.<br><br></div>I have setup ejabberd and opened port 5222.<br><br></div>I have setup nginx as a reverse proxy for ejabberd server. The nginx configuration is as follows.<br><br><i>stream{<br> upstream ejabberd-servers{<br> server ejabberd:5222;<br> }<br> server{<br> listen 5222;<br> proxy_pass ejabberd-servers;<br> }<br>}</i><br><br></div><b>ejabberd</b> point to the ejabberd server and I am using a docker container to reverse proxy.<br><br></div>The smack code I am using to connect is as shown below.<br><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Menlo""><i><font size="2"><span style="color:rgb(0,0,128);font-weight:bold">public void </span>createConnectionObject(){<br> AbstractXMPPConnection conn = <span style="color:rgb(0,0,128);font-weight:bold">null</span>;<br> <span style="color:rgb(0,0,128);font-weight:bold">try </span>{<br> XMPPTCPConnectionConfiguration.Builder builderConfig = XMPPTCPConnectionConfiguration.builder();<br> SmackConfiguration.<span style="color:rgb(102,14,122)">DEBUG </span>= <span style="color:rgb(0,0,128);font-weight:bold">true</span>;<br> builderConfig.setConnectTimeout(<span style="color:rgb(0,0,255)">60000</span>);<br> builderConfig.setHost(<span style="color:rgb(102,14,122);font-weight:bold">xmppHost</span>);<br> builderConfig.setPort(<span style="color:rgb(102,14,122);font-weight:bold">xmppPort</span>);<br> builderConfig.setServiceName(<span style="color:rgb(102,14,122);font-weight:bold">xmppDomain</span>);<br> builderConfig.setDebuggerEnabled(<span style="color:rgb(0,0,128);font-weight:bold">true</span>);<br> builderConfig.setSecurityMode(ConnectionConfiguration.SecurityMode.<span style="color:rgb(102,14,122);font-weight:bold">required</span>);<br> <span style="color:rgb(128,128,128)">/*System.setProperty("javax.net.ssl.trustStore", "classpath:hereimkeystore.jks");*/<br></span><span style="color:rgb(128,128,128)"> </span>builderConfig.setKeystoreType(<span style="color:rgb(0,128,0);font-weight:bold">"jks"</span>);<br> builderConfig.setKeystorePath(<span style="color:rgb(0,128,0);font-weight:bold">"classpath:mykeystore.jks"</span>);<br> ProxyInfo proxyInfo = getProxyInfo();<br> builderConfig.setProxyInfo(proxyInfo);<br> conn = <span style="color:rgb(0,0,128);font-weight:bold">new </span>XMPPTCPConnection(builderConfig.build());<br> conn.setPacketReplyTimeout(<span style="color:rgb(0,0,255)">100000</span>);<br> conn.connect();<br> }<span style="color:rgb(0,0,128);font-weight:bold">catch</span>(SmackException se){<br> System.<span style="color:rgb(102,14,122);font-weight:bold">out</span>.println(<span style="color:rgb(0,128,0);font-weight:bold">"Smack Exception thrown"</span>);<br> }<span style="color:rgb(0,0,128);font-weight:bold">catch</span>(IOException io){<br> System.<span style="color:rgb(102,14,122);font-weight:bold">out</span>.println(<span style="color:rgb(0,128,0);font-weight:bold">"IO Exception thrown"</span>);<br> }<span style="color:rgb(0,0,128);font-weight:bold">catch</span>(XMPPException xmppEx){<br> System.<span style="color:rgb(102,14,122);font-weight:bold">out</span>.println(<span style="color:rgb(0,128,0);font-weight:bold">"XMPP Exception thrown"</span>);<br> }<br> <span style="color:rgb(0,0,128);font-weight:bold">this</span>.<span style="color:rgb(102,14,122);font-weight:bold">connection </span>= conn;<br>}<br><br><span style="color:rgb(0,0,128);font-weight:bold">private </span>ProxyInfo getProxyInfo(){<br> ProxyInfo proxyInfo = ProxyInfo.forHttpProxy(<span style="color:rgb(102,14,122);font-weight:bold">xmppHost</span>, <span style="color:rgb(0,0,255)">443</span>, <span style="color:rgb(0,0,128);font-weight:bold">null</span>, <span style="color:rgb(0,0,128);font-weight:bold">null</span>);<br> <span style="color:rgb(0,0,128);font-weight:bold">return </span>proxyInfo;<br>}<br><br></font></i></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Menlo""><font size="2">But when I try to make the connection, I get the error <br>"java.net.SocketException: Unconnected sockets not implemented"<br><br></font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Menlo""><font size="2">I understand nginx will only serve as a tcp proxy, so any pointers on how to get this work?<br><br></font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Menlo""><font size="2">Regards<br></font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Menlo""><font size="2">Vaibhav <br></font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Menlo""><i><font size="2"></font></i></pre><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 2, 2016 at 3:35 PM, Marcel Waldvogel <span dir="ltr"><<a href="mailto:marcel.waldvogel@uni-konstanz.de" target="_blank">marcel.waldvogel@uni-konstanz.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>With BOSH you can do the same things as with direct c2s XMPP (and even more, because guessing an RID is enough). So what should be the security concerns of using 5222 directly instead of 5280?<span class="HOEnZb"><font color="#888888"><br>
<br>
<font color="#4c33e5"><a href="https://me.uni.kn/marcel.waldvogel" target="_blank"><font color="#4c33e5"></font></a><font color="#4c33e5"><a href="https://me.uni.kn/marcel.waldvogel" target="_blank">-Marcel Waldvogel</a></font></font></font></span><span class=""><br><br>-----Original Message-----<br>From: Vaibhav Ranglani <<a href="mailto:ranglani.vaibhav@gmail.com" target="_blank">ranglani.vaibhav@gmail.com</a>><br>To: Jabber/XMPP software development list <<a href="mailto:jdev@jabber.org" target="_blank">jdev@jabber.org</a>><br></span><span class="">Sent: Sa., 02 Juli 2016 11:57<br>Subject: Re: [jdev] Message sending performance XEP-0124<br><br></span></div><div class="HOEnZb"><div class="h5"><div dir="ltr"><div><div><div>Thanks for the inputs Florian.<br><br></div>This question is then related to the deployment side. Should I proxy the nginx server to ejabberd port 5222? If yes, then can somebody point to a post where this has been explained?<br><br></div><div>Also wouldn't directly exposing port 5222 to the internet cause security concerns?<br></div><div><br></div>Thanks<br></div>Vaibhav<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 2, 2016 at 3:18 PM, Florian Schmaus <span dir="ltr"><<a href="mailto:flo@geekplace.eu" target="_blank">flo@geekplace.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 01.07.2016 16:22, Marcel Waldvogel wrote:<br>
> For reliability requirements over wireless connections: don't use BOSH;<br>
> do use Stream Management (XEP-0198)<br>
<br>
</span>Exactly. And if you want the BOSH advantage over XMPP's TCP binding,<br>
i.e., using standard HTTP(S) ports, then use XMPP's WebSocket binding<br>
(RFC 7395) + Stream Management.<br>
<br>
Some background to this thread:<br>
<a href="https://community.igniterealtime.org/message/258562#comment-258562" rel="noreferrer" target="_blank">https://community.igniterealtime.org/message/258562#comment-258562</a><br>
<br>
I have not much experience with BOSH as I don't/seldom use it. I've<br>
merged Smack's BOSH branch when I took over Smack and fixed a few<br>
things, but the code should be considered unmaintained.<br>
<br>
I wonder if BOSH is suitable for mobile environments. In my experience<br>
those environments require being able to check the underlying TCP<br>
connection for liveness, which is not trivial when using BOSH I imagine.<br>
Using the BOSH Technique in mobile environments could cause serious UX<br>
issues if the first connection hangs in the long-polling state because<br>
the TCP connection broke down silently.<br>
<br>
WebSocket doesn't have this issues, and provides the same feature set as<br>
BOSH when used with Stream Management. I think it is the future and that<br>
there is no real reason, besides implementation availability, to use<br>
BOSH any more. Sadly there is no support for XMPP over WebSocket in<br>
Smack (yet).<br>
<span><font color="#888888"><br>
- Florian<br>
<br>
</font></span><br>_______________________________________________<br>
JDev mailing list<br>
Info: <a href="http://mail.jabber.org/mailman/listinfo/jdev" rel="noreferrer" target="_blank">http://mail.jabber.org/mailman/listinfo/jdev</a><br>
Unsubscribe: <a href="mailto:JDev-unsubscribe@jabber.org" target="_blank">JDev-unsubscribe@jabber.org</a><br>
_______________________________________________<br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
JDev mailing list<br>
Info: <a href="http://mail.jabber.org/mailman/listinfo/jdev" rel="noreferrer" target="_blank">http://mail.jabber.org/mailman/listinfo/jdev</a><br>
Unsubscribe: <a href="mailto:JDev-unsubscribe@jabber.org">JDev-unsubscribe@jabber.org</a><br>
_______________________________________________<br>
<br></blockquote></div><br></div>