on 11-20-2014 12:44 PM
Hi there,
I've read a lot about PCo and its ability to provide WebSockets. There is a document about configuring PIC consuming the PCo data here:
The SSCE is able to use the WebSockets provided by PCo. However, how do I consume the WebSockets via a SAPUI5 application I wrote myself? Is there a help document for this issue?
Regards
Tobias
Hi Tobias,
you could simply add an update call to the model you use for the MVC:
mockWs.onmessage = function(event) {
// retrieve the message and put it into a JSONModel
var jsonData = JSON.parse(event.data);
oModel.setProperty("/some", jQuery.merge([jsonData], oModel.getProperty("/some")));
oModel.refresh(/* force */ true);
};
See this gist for a working example: Example Websocket usage with Sapui5
Am I missing something? I guess you are looking for something a bit more built-in.
Regards,
M.
(... hm, I wonder why the syntax highlighting is broken ...)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Martin, this is a very good example, but using standard JavaScript WebSocket. I thought about using a SAPUI5 class like SapPcpWebSocket, see here:
Anyway, using standard WebSocket doesn't seem to be that complex. Thanks for your solution.
Regards
Tobias
User | Count |
---|---|
11 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.