{"action":"closed","issue":{"url":"https://api.github.com/repos/mxcube/mxcube3/issues/6","labels_url":"https://api.github.com/repos/mxcube/mxcube3/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/mxcube/mxcube3/issues/6/comments","events_url":"https://api.github.com/repos/mxcube/mxcube3/issues/6/events","html_url":"https://github.com/mxcube/mxcube3/issues/6","id":108818318,"number":6,"title":"User interface and server message handler","user":{"login":"meguiraun","id":12758327,"avatar_url":"https://avatars.githubusercontent.com/u/12758327?v=3","gravatar_id":"","url":"https://api.github.com/users/meguiraun","html_url":"https://github.com/meguiraun","followers_url":"https://api.github.com/users/meguiraun/followers","following_url":"https://api.github.com/users/meguiraun/following{/other_user}","gists_url":"https://api.github.com/users/meguiraun/gists{/gist_id}","starred_url":"https://api.github.com/users/meguiraun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meguiraun/subscriptions","organizations_url":"https://api.github.com/users/meguiraun/orgs","repos_url":"https://api.github.com/users/meguiraun/repos","events_url":"https://api.github.com/users/meguiraun/events{/privacy}","received_events_url":"https://api.github.com/users/meguiraun/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mxcube/mxcube3/labels/core","name":"core","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/mxcube/mxcube3/milestones/2","html_url":"https://github.com/mxcube/mxcube3/milestones/January%202016","labels_url":"https://api.github.com/repos/mxcube/mxcube3/milestones/2/labels","id":1328498,"number":2,"title":"January 2016","description":"All core packages should be running, mxcube3 will be used at Biomax for commissioning the diffractometer (not all the features will be used but the ones related to the udiff)","creator":{"login":"meguiraun","id":12758327,"avatar_url":"https://avatars.githubusercontent.com/u/12758327?v=3","gravatar_id":"","url":"https://api.github.com/users/meguiraun","html_url":"https://github.com/meguiraun","followers_url":"https://api.github.com/users/meguiraun/followers","following_url":"https://api.github.com/users/meguiraun/following{/other_user}","gists_url":"https://api.github.com/users/meguiraun/gists{/gist_id}","starred_url":"https://api.github.com/users/meguiraun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meguiraun/subscriptions","organizations_url":"https://api.github.com/users/meguiraun/orgs","repos_url":"https://api.github.com/users/meguiraun/repos","events_url":"https://api.github.com/users/meguiraun/events{/privacy}","received_events_url":"https://api.github.com/users/meguiraun/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":3,"state":"open","created_at":"2015-09-29T07:52:21Z","updated_at":"2015-11-10T12:24:09Z","due_on":"2016-01-14T23:00:00Z","closed_at":null},"comments":1,"created_at":"2015-09-29T08:27:23Z","updated_at":"2015-11-10T12:24:09Z","closed_at":"2015-11-10T12:24:09Z","body":"Extend the existing messaging system to the web. Flask-socketIO (websockets) can be used to send the pydispatcher’s signals to Javascript functions. It is also possible to define different namespaces over a single websocket. Flask-SocketIO transparently downgrades itself for older browsers that don’t have WebSocket, SocketIO emulates the connection using one of the older solutions, the best one available for each given client.\r\n\r\nTwo kind of signals:\r\n* Signal from HO to HO (hidden for the user, so no action is required)\r\n* Signals from HO to User interface\r\n\r\nIn any case, whenever a signal is intercepted for sending to the ui, it must fulfill a generic structure (to be defined), in order to ease the data retrieval in the web interface.\r\n\r\nCode example:\r\n```python\r\nfrom flask.ext.socketio import emit\r\n#generic and unfiltered callback, it just will send all messages to the web interface\r\ndef signalCallback(signal, sender, *args): \r\n\tsocketio.emit('test',{'data':'A signal', 'signal': signal, \\\r\n\t\t'sender':str(sender.__class__).split('.')[0]}, \\\r\n\t\tnamespace='/test')\r\n#in the init code of the resolution hardware object (as example) we link the 'DeviceReady' message with the callback function\r\nself.resolution.connect(self.resolution,'deviceReady', signalCallback)\r\n```\r\nWe need to add `self.someHO.connect(hw_obj, 'aSignal', 'aCallback')` for each message we want to propagate to the user interface. For that, we need the lists of messages for each hw_obj, such as the following:\r\n\r\n```python\r\nMaxLabMicrodiff_signals = ['diffractometerMoved', 'minidiffReady', 'minidiffNotReady',\r\n'phiMotorStateChanged' ......]\r\n\r\nBL9113MultiCollect_signals = ['collectReady', 'collectImageTaken', 'collectReady',\r\n'collectStarted', ....]\r\n```\r\nAnd add these lists to a config.py (or config/messages.py or whatever)\r\n"}}