emit, MQTT module and event name too long #504
Replies: 3 comments
-
Posted at 2015-11-13 by @gfwilliams Thanks, I'll take a look at this. I might just be able to totally remove that restriction - it seems a bit random converting back to a C string |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-13 by @gfwilliams Ok, just got it working with longer constants. I think the issue was (and it's a bit of a hack), |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-13 by Moray Great, thanks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-11-12 by Moray
The MQTT module emits 'disconnected' when you call disconnect - https://github.com/espruino/EspruinoDocs/blob/master/devices/MQTT.js#L167
For me, this returns an error "event name too long".
A quick look at Espruino's source code [https://github.com/espruino/Espruino/blob/f18509acff2a9fdfb8d7414f46b4e546e3be01d3/src/jswrap_object.c#L484] suggests that an event name can be up to 12 characters long (16 is the length of the constant, minus 4 as in the line of code)
'Disconnected' is 12 characters long, so I feel like it should work, so I'm not quite sure what's going on here.
Beta Was this translation helpful? Give feedback.
All reactions