How do i get to use MQTT on Google App Engine?

536 views
Skip to first unread message

Chrispinus Onyancha

unread,
Nov 19, 2015, 3:14:02 AM11/19/15
to MQTT
I have my mosquito server running in a Google Compute VM, i want the client to run on App Engine. I know Google does not support socket listening on App engine, i would like to has my client on App engine but how do i do it? Any Ideas?  

Karl Palsson

unread,
Nov 19, 2015, 5:49:25 AM11/19/15
to mq...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Why do you think it won't work? MQTT clients don't have listening
sockets. That's a very core part of how the protocol works.

- --
Sent using Mailpile, Free Software from www.mailpile.is

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJWTajkAAoJEBmotQ/U1cr2A3wP/RNHL+rypW1FAIpzSTluK0gV
kX6Ywehzv5sAIEodzRefbwdDSeu8VwmEjxRrZ6gP13WxA6o4peRATFAf9iEDwPyo
4E2Z1SbJAST3fKsG+0Mwns9yhz61+kj9jBUFsmXe0fwfCAsE/jo50c91mh7crxDH
0kbR+z9A+x/l7sP9+wO7SUuuF4WaaoQqnDiqj3DoHLQPmRIqmSZ/sXhoTgbW5iW5
klhVk9EkjH92ZozayVYVqRHGTq+fxHtzYnJDX4WkEK/FmB8n36zS2TAs/qhzegR0
WItZFrvJth0JfvIKHHUFw4o/VeAW1rldvAve54QTg9YXiGx6203V0kt04sAwKJb1
3JAdVHfKVdtYFjJFr78Y0r64nezHjCTE5c0xiVwkJ8VdwRN8JJdONiTlAd5OGyxr
K3bzr7nIJEHEh3pvZdaQBnhWNBtFCpe+DVk49C0IAQC9obya91isaByewfo47voG
JCHduplhzSARfBQMNO9ukWknrT4ZRp6Whz/Npr3feO8wkosrfHRMLV9EvFI7H/4r
aTjMlszuAwZOaF8J+cj5+k2WewQ8PKj2Yl+wrm6uUzVZI6245FhtjqP0on0tls8U
1CQ2p2fp7fnZAJsopFh8egC7d4lUUCUv0qSgq3dAgWf1xs2ij3yJiv79vgABBMV5
2DyvSAEalO//PrOGtebJ
=E/iu
-----END PGP SIGNATURE-----

Hans Jespersen

unread,
Nov 21, 2015, 5:00:40 PM11/21/15
to MQTT
What error do you get when you try and run it?

Ravi K

unread,
Apr 1, 2017, 4:11:14 PM4/1/17
to MQTT
did you finally figure this out? i'm running a client in a module (backend) like follows:

import paho.mqtt.client as mqtt

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 dev environment on_connect() never gets called so assuming it's silently failing elsewhere. in production it fails even earlier at mqtt.Client() with this error

 File "/base/data/home/apps/s~xxxxxx/worker:v0.400234758085693169/worker.py", line 20, in work client = mqtt.Client() File "/base/data/home/apps/s~sensorswarms/worker:v0.400234758085693169/lib/paho/mqtt/client.py", line 494, 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, 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 return getattr(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

thoughts?
Reply all
Reply to author
Forward
0 new messages