In PyBlox, I have the following code (in a sprite):
device = '...' # change these
password = '...' # change these
@onstart()
def my_onstart(self):
nb.phone_iot.set_credentials(self.device, self.password)
nb.phone_iot.listen_to_sensors(self.device, { 'accelerometer': 100 })
@nb.on_message('accelerometer')
def my_onmessage(self, x, y, z):
self.say(x)
Nothing gets displayed, but the cloud server shows posts to /network/messages/ and NetsBlox/PyBlox-generated messages are correctly received in PyBlox (just not service-generated messages). It looks like what's happening is that the sendMessage feature on external client instances (which are used as the socket objects provided to services) are always explicitly constructing a browser target object, so lookup of the target fails and the message is dropped at cloud.
In PyBlox, I have the following code (in a sprite):
Nothing gets displayed, but the cloud server shows posts to
/network/messages/and NetsBlox/PyBlox-generated messages are correctly received in PyBlox (just not service-generated messages). It looks like what's happening is that thesendMessagefeature on external client instances (which are used as thesocketobjects provided to services) are always explicitly constructing abrowsertarget object, so lookup of the target fails and the message is dropped at cloud.