TAMULib / weaver-components

Custom Web Components for the Weaver UI
MIT License
0 stars 1 forks source link

Issue 407: Weaver Components should provide a Message Receiver Component. #449

Closed kaladay closed 3 years ago

kaladay commented 3 years ago

Add stompjs and sockjs-client dependencies.

Implement StompManifest and StompClient. This implementation is based off of the Manifest.

A stomp-client-protocol is provided with LONG_POLLING, WEB_SOCKET, and SERVER_SIDE_EFFECT but only WEB_SOCKET is guaranteed at this time. More work may be necessary to get the other two to work.

The feature requests "Message Receiver Component" but there is initial structure for sending messages. This is not implemented at this time and only the "Receiver" part of the component is provided.

Additional work to manage unsubscription on disconnect may be needed for proper maintenance and cleanup tasks.

There are a few mapping strategies provided:

The WEABER will deconstruct the weaver message structure and re-map it to a more flexible json structure. The JSONPARSE will directly parse the string into json structure without any alterations. The NONE should pass the response through as a string.

This (in theory) supports multiple manifests. This supports multiple manifest entries via a single manifest. This supports custom mapping-strategies per entry as well as a mapping-strategy global to the manifest.

Due to time constraints, only minimal tests are added.

Example Generic usage:

  <wvre-message-manifest name="Wvr Message Manifest" broker-url="http://localhost:8181/ws" mapping-strategy="jsonparse" protocol="WEB_SOCKET">
    <wvre-message-manifest-entry name="Echo" destination="/echo"></wvre-message-manifest-entry>
    <wvre-message-manifest-entry name="Board" destination="/board"></wvre-message-manifest-entry>
  </wvre-message-manifest>

resolves #407