Closed pavledragisic closed 2 years ago
This is currently a limitation in Remote Manager, as Remote Manager uses the same mechanism. The actual issue is that the request to open the WebSocket
for WebEvent
is handled by the Remote Manager server and not forwarded to the device.
@pavledragisic this functionality does exist, I've needed it and implemented it a while ago, but it is not yet released anywhere
@aleks-f This has already been fixed in macchina.io REMOTE some time ago.
ok, I didn't know
Expected Behavior
When accessing Macchina.io Web UI all bundles that are subscribed to Web Events should be notified when Web Event notify method has been called, and then they can access Web Event data. Bundles subscribed to that event should receive event data unrelated to Web UI connection type (Direct access via IP address in LAN or via macchina.io Remote Manager.
Actual Behavior
When accessing Macchina.io Web UI via IP address in LAN Web Events work, and bundles get notified and can access Web Event data. On the other hand when accessing Web UI using Remote Manager bundles that are subscribed don’t get notified and don’t get Web Event data.
Steps to Reproduce
Reproducing this issue can be done using Macchina.io SensorLog bundle. SensorLog bundle is using Web Events to monitor sensor value changes. To see if bundle is receiving Web Events we can just add one console.log in the function that is handling Web Event.
In file macchina.io/samples/SensorLog/bundle/webapp/js/controllers.js / on the line 71 method onNotify should look like this:
WebEvent.onNotify = function(evt) { for (var id in $scope.sensors) { if ('sensorlog.' + id == evt.subject) { $scope.sensors[id].value = parseFloat(evt.data); console.log("SensorLog Event"); console.log(evt.data); } } $scope.$apply(); };
After editing controllers.js recompile SensorLog bundle and start macchina.io. Device running macchina.io should be registered in Remote Manager.
Web UI pages accessed via LAN and Remote Manager are shown bellow. We can see that there is no console log on the page accessed via Remote Manager.
Web UI accessed via LAN
Web UI accessed via Remote Manager
macchina.io Version
macchina-2020.1-release
Compiler and Version
gcc --version gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Operating System and Version
System information: Linux (4.19.150) on armv7l