webui-vue icon indicating copy to clipboard operation
webui-vue copied to clipboard

Move away from /subscribe websocket

Open gtmills opened this issue 4 years ago • 3 comments

https://github.com/openbmc/webui-vue/blob/6b0e3a71cb691d24e5153cd4d4ec10e174ae4398/src/store/plugins/WebSocketPlugin.js#L27

Could move to just normal polling or Redfish events

https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/29344 turns the default of REST D-Bus to OFF. To make the webui-vue GUI work with this default setting would need this and #35

gtmills avatar Oct 13 '20 13:10 gtmills

I thought Redfish events was not going to be read for some time. Is there a time dependency on this story?

derick-montague avatar Oct 14 '20 14:10 derick-montague

I would prefer to have a subscription model over client-side polling. If we want to move away from web sockets, we could consider using a library like socket.io, which will create the bi-directional functionality if web sockets are not supported.

Socket.io

Socket.IO simplifies the WebSocket API and unifies the APIs of its fallback transports. Transports include:

  • WebSocket
  • Flash Socket
  • AJAX long-polling
  • AJAX multipart streaming
  • IFrame
  • JSONP polling

To my knowledge, we are not using bi-directional communication and we only need server-side pushes. If that is accurate, we could also consider using server-sent events. These work in all browsers but Internet Explorer 11. However, it could have some limitations if the serer is not using HTTP/2.

When not used over HTTP/2, SSE suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low number (6). The issue has been marked as "Won't fix" in Chrome and Firefox. This limit is per browser + domain, which means that you can open 6 SSE connections across all of the tabs to www.example1.com and another 6 SSE connections to www.example2.com (per Stackoverflow). When using HTTP/2, the maximum number of simultaneous HTTP streams is negotiated between the server and the client (defaults to 100).

derick-montague avatar Oct 25 '20 15:10 derick-montague

@derick-montague Hello,I have a question.If we choosed socket.io, ths language of bmcweb is C++ is not adapt at language of socket.io NodeJS.How can I conquer this problem?

fishermess avatar Jun 13 '23 03:06 fishermess