How about just running the client in a backend (service)? I have not been 
able to get data from a public broker


def on_connect(client, userdata, flags, rc):
 logging.info("Connected with result code "+str(rc))
 client.subscribe("#")             # wildcard for all topics


def on_message(client, userdata, msg):
 logging.info(msg.topic+" "+str(msg.payload))


def work(self):
 client = mqtt.Client()
 client.on_connect = on_connect
 client.on_message = on_message
 client.connect("broker.hivemq.com", 1883, 2)
 client.subscribe("#")
 client.loop(10)


in the dev environment it throws no errors but seems to fail silently as 
on_connect is never called. in production i see the following error:


File "/base/data/home/apps/s~xxxxxx/worker:v0.400234758085693169/worker.py", 
line 20 
<https://console.cloud.google.com/debug/fromlog?appModule=worker&appVersion=v0&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~sensorswarms%2Fworker%3Av0.400234758085693169%2Fworker.py&line=20&logInsertId=58deb732000f18de522a820e&logNanos=1490990898319526000&nestedLogIndex=0&project=sensorswarms>
, inwork client = mqtt.Client() File 
"/base/data/home/apps/s~sensorswarms/worker:v0.400234758085693169/lib/paho/mqtt/client.py"
, line 494 
<https://console.cloud.google.com/debug/fromlog?appModule=worker&appVersion=v0&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~sensorswarms%2Fworker%3Av0.400234758085693169%2Flib%2Fpaho%2Fmqtt%2Fclient.py&line=494&logInsertId=58deb732000f18de522a820e&logNanos=1490990898319526000&nestedLogIndex=0&project=sensorswarms>
, in __init__ self._sockpairR,self._sockpairW = _socketpair_compat() File 
"/base/data/home/apps/s~xxxxxxx/worker:v0.400234758085693169/lib/paho/mqtt/client.py"
, line 269 
<https://console.cloud.google.com/debug/fromlog?appModule=worker&appVersion=v0&file=%2Fbase%2Fdata%2Fhome%2Fapps%2Fs~sensorswarms%2Fworker%3Av0.400234758085693169%2Flib%2Fpaho%2Fmqtt%2Fclient.py&line=269&logInsertId=58deb732000f18de522a820e&logNanos=1490990898319526000&nestedLogIndex=0&project=sensorswarms>
, in _socketpair_compat listensock.bind(("127.0.0.1", 0)) File 
"/base/data/home/runtimes/python27/python27_dist/lib/python2.7/socket.py", 
line 222, in meth returngetattr(self._sock,name)(*args) File 
"/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py"
, line 676, in bind raise_SystemExceptionFromAppError(e) error: [Errno 22] 
Invalid argument


anyone get the paho lib to work as a client ?

On Wednesday, 15 April 2015 17:14:56 UTC-5, Vinny P wrote:
>
> On Wed, Apr 15, 2015 at 1:45 AM, krishna g <krishn...@gmail.com 
> <javascript:>> wrote:
>
>> As you are saying that listener socket is not supported in google app 
>> engine environment can you provide me any other alternative other than what 
>> you provided.
>>
>
>
>  You can see it noted in the documentation as well: go to 
> https://cloud.google.com/appengine/docs/python/sockets/#limitations_and_restrictions
>  
> and look at the part about listen sockets.
>
> As for alternatives, using a Managed VM or a Compute Engine machine are 
> probably the best alternatives you're going to get. If you're looking for a 
> free hosted tier, it looks like CloudMQTT ( http://www.cloudmqtt.com/ ) 
> has a free trial available on their site.
>  
>  
> -----------------
> -Vinny P
> Technology & Media Consultant
> Chicago, IL
>
> App Engine Code Samples: http://www.learntogoogleit.com
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/a6a8fcc6-bdaf-4987-ac26-1e8f663170c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Re: [google-appeng... Ravi K

Reply via email to