5 Replies Latest reply on Dec 20, 2014 1:16 AM by davejad

    Working with Raspberry and Whatsapp

    imec80

      So far I could try sending messages from Whatsapp to raspberry, raspberry sending messages from a cell phone and I need to do two tasks at once.

       

      Someone has information, as well to keep the conversation closes after 3 min

        • Re: Working with Raspberry and Whatsapp
          packetgeek

          Not sure what you're looking for but I think the connection loss (after 3 minutes) might be related to your cell phone carrier rather than WhatsApp.  That or (since WhatsApp appears to be customized XMPP service), there could be an automatic activity timeout.  I'm just guessing though.

            • Re: Working with Raspberry and Whatsapp
              imec80

              I'm controlling devices from Whatsapp and there comes a time that I get a message on the console terminal is closed the conversation, since there no longer receives more messages

                • Re: Working with Raspberry and Whatsapp
                  emotep

                  use python , import socket,time

                  every 2 minutes  connect to the whatsapp port, send foo and close. That should keep it alive indefinitely.

                  • Re: Re: Working with Raspberry and Whatsapp
                    iagorubio

                    Hi Alejandro,

                     

                    Looks like your problem - correct me if I am wrong - it's somewhat your console is being closed.

                     

                    If you are connected to that console through ssh you may end up with a message saying something like "connection closed by peer" after some time.

                     

                    If that is your problem, it happens because ssh closes the connection after some time of inactivity.

                     

                    You can order your client to "ping" the ssh server once in a while to avoid it to close the connection for inactivity.

                     

                    It's a setting in your ~/.ssh/config file called ServerAliveInterval and it's a number of seconds.

                     

                    ServerAliveInterval 60

                     

                    Will ping the server each 60 seconds. That will maintain the ssh console open and working.

                     

                    From the ssh_config manual page:

                     

                         ServerAliveInterval

                                 Sets a timeout interval in seconds after which if no data has

                                 been received from the server, ssh(1) will send a message through

                                 the encrypted channel to request a response from the server.  The

                                 default is 0, indicating that these messages will not be sent to

                                 the server.  This option applies to protocol version 2 only.

                     

                    If you don't have that file and have to create it, remember to make it only readable by yourself, because ssh complains if the file is world readable.

                     

                    echo ServerAliveInterval 60 >>  ~/.ssh/config

                    chmod 600 ~/.sshd/config

                • Re: Working with Raspberry and Whatsapp
                  davejad

                  I added my Whatsapp account powered by Raspberry to a group. The result I got a Trace back problem. The group was deleted the. Can someone help me resolve it ?