Liking cljdoc? Tell your friends :D

matthiasn.systems-toolbox-sente.client

This namespace contains a component for the client side of WebSockets communication.

This namespace contains a component for the client side of WebSockets
communication.
raw docstring

all-msgs-handlercljs

(all-msgs-handler {:keys [cmp-state msg-meta msg-type cfg] :as msg-map})

Handler function for all incoming messages. By default, all messages received by this component are forwarded to the server. When message filtering is enabled for this component, it will instead only forward messages to the server for which the :forward-to-backend key is set in the message metadata.

Handler function for all incoming messages. By default, all messages received
by this component are forwarded to the server. When message filtering is
enabled for this component, it will instead only forward messages to the
server for which the :forward-to-backend key is set in the message metadata.
sourceraw docstring

client-state-fncljs

(client-state-fn cfg)

Returns a function that returns the initial component state for the sente client component. Also sets the systems-toolbox-open-requests cookie when the component is configured to record the number of open backend requests.

Returns a function that returns the initial component state for the sente
client component.
Also sets the systems-toolbox-open-requests cookie when the component is
configured to record the number of open backend requests.
sourceraw docstring

cmp-mapcljs

(cmp-map cmp-id)
(cmp-map cmp-id cfg)

Returns configuration map for creating a client-side WebSockets communication component. In any case, it requires to specify the component ID. Additional configuration options can be provided in the second argument. Here, we can configure behavior such as only forwarding messages that have the :forward-to-backend key set on the message metadata. This has been added in version 0.5.10 - specifically requiring to enable this filtering mechanism avoids breaking backward compatibility. Also, there's an option to count open requests. This option should be enabled together with :msg-filtering and will keep a set of open backend requests and record the count in a cookie. This can be useful in testing when we want to determine when the UI is stable. Note that for inclusion in the counter, the :expect-backend-response key needs to be set on the message metadata.

Returns configuration map for creating a client-side WebSockets communication
component. In any case, it requires to specify the component ID. Additional
configuration options can be provided in the second argument. Here, we can
configure behavior such as only forwarding messages that have the
:forward-to-backend key set on the message metadata. This has been added in
version 0.5.10 - specifically requiring to enable this filtering mechanism
avoids breaking backward compatibility. Also, there's an option to count open
requests. This option should be enabled together with :msg-filtering and will
keep a set of open backend requests and record the count in a cookie.
This can be useful in testing when we want to determine when the UI is stable.
Note that for inclusion in the counter, the :expect-backend-response key
needs to be set on the message metadata.
sourceraw docstring

handle-first-opencljs

(handle-first-open put-fn ws)

After component is ready and before WS connection is established, there's a small window during which another components might try to send something. Those messages would get lost, so they are buffered in :buffered-msgs until connection is ready.

After component is ready and before WS connection is established, there's a
small window during which another components might try to send something.
Those messages would get lost, so they are buffered in :buffered-msgs until
connection is ready.
sourceraw docstring

make-handlercljs

(make-handler put-fn cmp-state cfg)

Creates a handler function for messages from WebSocket connection. Calls put-fn with received messages. Also updates the open requests cookie by decreasing the number when a message is encountered for which there was an expectation for a response from the backend.

Creates a handler function for messages from WebSocket connection. Calls
put-fn with received messages. Also updates the open requests cookie by
decreasing the number when a message is encountered for which there was an
expectation for a response from the backend.
sourceraw docstring

prepare-msgcljs

(prepare-msg state {:keys [msg-type msg-payload msg-meta]})

Converts a map with :msg-type, :msg-payload and :msg-meta into a vector that can be passed to send-fn. It also sets :sente-uuid on msg-meta.

Converts a map with :msg-type, :msg-payload and :msg-meta into a vector that
can be passed to send-fn. It also sets :sente-uuid on msg-meta.
sourceraw docstring

(set-cookie name value valid)

Helper function for setting a cookie with the provided name.

Helper function for setting a cookie with the provided name.
sourceraw docstring

update-open-requestcljs

(update-open-request request-tags)

Updates a cookie with the number of open requests. This cookie can then be used in tests to wait for all backend requests to be answered before making any assertions about the UI. The cookie is valid for 15 minutes for now. This value is entirely arbitrary - feel free to submit a PR that makes this value configurable, should the need arise.

Updates a cookie with the number of open requests. This cookie can then be
used in tests to wait for all backend requests to be answered before making
any assertions about the UI. The cookie is valid for 15 minutes for now.
This value is entirely arbitrary - feel free to submit a PR that makes this
value configurable, should the need arise.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close