jbuitt / nwws-php-client

NOAA Weather Wire Service (NWWS) PHP Client
MIT License
6 stars 1 forks source link

Connection Refused #6

Open RivendellGuru opened 4 years ago

RivendellGuru commented 4 years ago

Thanks for this! But we're getting a connection refused ...

Uncaught Fabiang\Xmpp\Exception\ErrorException: stream_socket_client(): unable to connect to tcp://nwws-oi.weather.gov:5223 (Connection refused) in /home/vvsv1/public_html/ax_vwx/vwx_nwws/vendor/zorn-v/xmpp/src/Stream/SocketClient.php:118

In checking the NWWS OI page it says the port is now 5223, instead of the 5222 in the included composer.json. They also say any HTTP requests without a user agent string are summarily blocked.

We've tried several of our account credentials that work with the EUC. Same error. Is it possible this now needs an update to send a user agent string?

Thanks for any insight.

rlkollman commented 4 years ago

Did you try with port 5222? I've been connecting without any issue on the original port 5222 - wonder if their FAQ is just a typo... I got hung up on their 'HTTP requests must have a user-agent string' as well, but since XMPP is not using HTTP, the user-agent requirement is not necessarily the same. However, Fabiang XMPP client does send a user-agent to the server to identify itself - so, even if that is a requirement, it's being met with that library.

And then, remember they will only allow 1 connection per user account. I have never experienced what happens if you exceed that allotment, so, is it possible you may have duplicated a connection?

I would try using another XMPP client (I used Pidgin heavily while trying to figure this all out) and try getting in that way. Then, you can eliminate this software package as the culprit and it's obviously something external to this project.

Hope that helps ? Maybe? ;-)

RivendellGuru commented 4 years ago

Hi,

Thank you so much for taking the time to reply.

Yes. I should have mentioned. I started with port 5222.Went to 5223. Back to 5222. Tried each port with each of the two user accounts that are not running elsewhere, both without the brackets as they are entered into the NUC and with the brackets just in case. We’re running PHP7.0. Have the ini file set to allow remote streams/socketds. Disabled firewalld entirely. Tried the python version, same issue.

I didn’t think there’d be a user-agent ability for XMPP but I am not very familiar with it, and I’ve run out of things to try for the moment. The main issue I have with the NUC running on Windows and Windows VM’s we’ve created is that often when an internet connection drops and reconnects their server thinks there is still a user connect, flags a conflict, and shuts everything down. Also connecting often takes a lot of fiddling to get past connection time out errors.

Because of that we run three separate instances with three separate accounts feeding bulletins to our dedicated servers so that in case one goes away the others are still feeding bulletins.

I’d really like to run this directly on the server but I can’t figure out quite why the connection is being refused.

I actually just started looking at Pidgin. I may try running it on a couple of less protected linux boxes elsewhere and see if that helps.

But for the record, it’s port 5222? And the password/username without brackets that you’re using?

Thanks again!

Tom Churchill

Virtual Voice Technologies

From: rlkollman [mailto:notifications@github.com] Sent: Sunday, December 29, 2019 5:58 PM To: jbuitt/nwws-php-client nwws-php-client@noreply.github.com Cc: RivendellGuru team@rivendell.guru; Author author@noreply.github.com Subject: Re: [jbuitt/nwws-php-client] Connection Refused (#6)

Did you try with port 5222? I've been connecting without any issue on the original port 5222 - wonder if their FAQ is just a typo... I got hung up on their 'HTTP requests must have a user-agent string' as well, but since XMPP is not using HTTP, the user-agent requirement is not necessarily the same. However, Fabiang XMPP client does send a user-agent to the server to identify itself - so, even if that is a requirement, it's being met with that library.

And then, remember they will only allow 1 connection per user account. I have never experienced what happens if you exceed that allotment, so, is it possible you may have duplicated a connection?

I would try using another XMPP client (I used Pidgen heavily while trying to figure this all out) and try getting in that way. Then, you can eliminate this software package as the culprit and it's obviously something external to this project.

Hope that helps ? Maybe? ;-)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jbuitt/nwws-php-client/issues/6?email_source=notifications&email_token=AKYLAGQXPJ3T2XA6CDIFUJ3Q3EMMZA5CNFSM4KBA5QSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHZJGNY#issuecomment-569545527 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AKYLAGU2RNCW2NXNKZGAHBLQ3EMMZANCNFSM4KBA5QSA .

rlkollman commented 4 years ago

Here is my configuration file (with username/password removed, obviously). This configuration is working fine for me on Debian 9. The username and password are not including the brackets -- [] -- correct. { "server": "nwws-oi.weather.gov", "port": 5222, "username": "firstname.lastname", "password": "password_given_by_nws", "resource": "nwws-php", "logpath": "/var/log/wx-center/nwws", "logprefix": "logfile", "archivedir": "/var/nwws/arc", "pan_run": "" }

Initially, I did find issues with that resource field - it seemed that if it was not unique on the system, I would not receive the NWS Products- but not a refused connection. By using Pidgin to see what's going on in the chat room, I believe most people are setting the resource to their username and then it is, obviously, unique. I had been using nwws-php as my resource previously without issues. I just wrote an nwws client in .net for Windows as I have some specific use case needs for Windows - but I did just try the php client again (on Debian 9.11 on a Digital Ocean droplet) and it is working for me as it did before.

When I enter an incorrect username and password into the config file, the error actually specifies 'not authorized' rather than unable to connect 'connection refused': PHP Notice: Undefined index: wmofilter in /opt/wxserver/nwws/nwws2.php on line 42 PHP Fatal error: Uncaught Fabiang\Xmpp\Exception\Stream\AuthenticationErrorException: Stream Error: "not-authorized" in /opt/wxserver/nwws/vendor/zorn-v/xmpp/src/Exception/Stream/StreamErrorException.php:77 Stack trace: ...

So I would guess the username and password are not your issue, but that you simply are unable to reach the server from the VM where your NWWS Client is hosted.

jbuitt commented 3 years ago

Apologies for not responding sooner, I had been devoting most of my time to other projects.

Thank you all for providing your experience with the different ways of connecting to NWWS! IIRC, you need to use port 5222 on a system with recent version of OpenSSL. I could never get legacy SSL connections on port 5223 to work, even though the port shows appears open. Also, if the system's CA certificate list is not up to date, connections to nwws-oi.weather.gov will also fail, resulting in certificate trust error.

If you are not having any additional problems related to this issue, I'll go ahead and close this one.

Thanks! Jim