Google Hangouts Bot on Smack 4.1

(This is mostly a copy of the Stack Exchange post I made a while back.)

I’ve been running a Google Hangouts bot on Smack 4.1 for a few years on my RaspberryPi. (It uses an @gmail.com account.) The bot was down for a few months due to another issue, which I just fixed. Unfortunately, it now won’t log in to talk.google.com. Should I upgrade to Smack 4.3 or is there another issue here that I need a fix for?

Here’s the error I’m getting now:

org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s).  Used filter: No filter used or filter was 'null'.
at org.jivesoftware.smack.SmackException.....

I tried to change the timeout length, but it still says 5000 ms. Here’s the code I’m using to try to log in:

XMPPTCPConnectionConfiguration.Builder configurationBuilder = XMPPTCPConnectionConfiguration.builder();
configurationBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.required);
configurationBuilder.setUsernameAndPassword(userName, password);
configurationBuilder.setCompressionEnabled(false);
configurationBuilder.setServiceName("gmail.com");
configurationBuilder.setPort(port);
configurationBuilder.setHost("talk.google.com"); //gmail.com
configurationBuilder.setConnectTimeout(15000);
this.configuration = configurationBuilder.build();

SASLAuthentication.registerSASLMechanism(new SASLXOauth2Mechanism());

this.connection = new XMPPTCPConnection(this.configuration);
this.connection.setUseStreamManagement(false);
this.connection.setUseStreamManagementResumption(false);
System.out.println("  Connecting to the Google Hangouts server...");
this.connection.connect(); /* Connect to the XMPP sever */
System.out.println("  Connection to Google Hangouts server made...");
...

It fails on the call to connect().

Do I need to reconfigure everything to work with Smack 4.3, or will that not help? Is there some completely different solution I should be looking for?

I thought google was shutdown xmpp, and is in the processes of shutting down hangouts…

2 Likes

Okay, this is exactly the kind of info I needed, thank you!

I found an article about them shutting down hangouts sometime next year: https://tech.slashdot.org/story/18/11/30/2157254/google-hangouts-for-consumers-will-be-shutting-down-sometime-in-2020

I don’t see anything about them canceling XMPP support in the past six months or so. Is there a link to something about this?

I guess I need to decide where to go from here. What’s my best option for migrating things? I’m not sure I’m aware of all the options. Can I still use Smack through something like Jabber?

https://developers.google.com/talk/open_communications
at the top
We announced a new communications product, Hangouts, in May 2013. Hangouts will replace Google Talk and does not support XMPP.

1 Like

If you mean XMPP/Jabber in general, then yes. Smack is a library to work with XMPP. Unless you mean some specific product/software called Jabber.

1 Like

Okay, but I’d been using it successfully until the end of 2018. I’m not sure at what point it actually stopped working.

Okay, that makes sense (and only goes to show how little I know about the actual names of the different technologies). How else can I host/register my bot in a useable way? In the past, I would talk to my bot via my normal Google account.

You would need a XMPP server, either some public or hosted by you. You can then have an account on this server and talk with your bot with that account, i guess.

2 Likes

That definitely makes it sound like I should look into other options first.

Update:
This started working again and I’m not sure why. I was able to extend the timeout length using a separate method: Connection.setPacketReplyTimeout. I extended that to longer, but the times when it’s connected, it doesn’t seem to have mattered. Instead, it seems to be connecting once quickly and easily, but if it doesn’t take on the first try, it will take longer on subsequent tries.

Both of the times it’s made a successful connection, it’s the first connection attempt I tried that morning. I would experiment with it more, but I don’t want it to come down and not be able to get it back up.

I learned here that Google isn’t using XMPP anymore, but Smack is still working with talk.google.com, so it’s still working as a way for me to launch the bot.

It is a common misconception that Google “is not using XMPP anymore”. What they IIRC did is disabling XMPP federation, but the XMPP interface is (obviously) still there.

That said, it is not clear how it continues to be there.

2 Likes

Oh, that’s interesting. I guess that explains why I don’t remember changing anything when they stopped it.

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.