(add-listener listeners listener)
(make-channel-server &
{:keys [handshake-data-fn server-adapter client-id-fn
dependencies valid-client-id-fn transit-handlers]})
DEPRECATED! Do not use for new code. See websockets.cljc.
Creates ChannelServer
.
Params:
handshake-data-fn
(Optional) - Used by sente for adding data at the handshake.server-adapter
(Optional) - adapter for handling servers implemented by sente. Default is http-kit.client-id-fn
(Optional) - returns a client id from the request.dependencies
(Optional) - adds dependecies to the fulcro handler.valid-client-id-fn
(Optional) - Function for validating websocket clients. Expects a client-id.transit-handlers
(Optional) - Expects a map with :read
and/or :write
key containing a map of transit handlers,DEPRECATED! Do not use for new code. See websockets.cljc. Creates `ChannelServer`. Params: - `handshake-data-fn` (Optional) - Used by sente for adding data at the handshake. - `server-adapter` (Optional) - adapter for handling servers implemented by sente. Default is http-kit. - `client-id-fn` (Optional) - returns a client id from the request. - `dependencies` (Optional) - adds dependecies to the fulcro handler. - `valid-client-id-fn` (Optional) - Function for validating websocket clients. Expects a client-id. - `transit-handlers` (Optional) - Expects a map with `:read` and/or `:write` key containing a map of transit handlers,
The primary multi-method to define methods for in order to receive client messages.
The primary multi-method to define methods for in order to receive client messages.
(notify-listeners f listeners ws-net cid)
(remove-listener listeners listener)
(route-handlers {:keys [config request]} _match)
Route handler that is expected to be passed to :extra-routes
when creating a Fulcro app.
Route handlers will look at optionally look at :ws-origin-whitelist
in your config file, and
validate origins trying to make a ws connection. If :ws-origin-whitelist
is nil, origins will
not be checked. The :origin
key will also be treated as a valid origin if checking is enabled.
Example:
Both the values in :origin
and :ws-origin-whitelist
will pass. Any other origin will return 403.
{:origin "localhost:8080"
:ws-origin-whitelist "www.example.io:3000"}
Origins will not be checked.
{:origin "localhost:8080"}
Route handler that is expected to be passed to `:extra-routes` when creating a Fulcro app. Route handlers will look at optionally look at `:ws-origin-whitelist` in your config file, and validate origins trying to make a ws connection. If `:ws-origin-whitelist` is nil, origins will not be checked. The `:origin` key will also be treated as a valid origin if checking is enabled. Example: Both the values in `:origin` and `:ws-origin-whitelist` will pass. Any other origin will return 403. ``` {:origin "localhost:8080" :ws-origin-whitelist "www.example.io:3000"} ``` Origins will not be checked. ``` {:origin "localhost:8080"} ```
(simple-channel-server &
{:keys [handshake-data-fn server-adapter client-id-fn
dependencies valid-client-id-fn
transit-handlers]})
Creates a channel server that uses the default server parser (you can use defmutation, defquery-root, etc.) for incoming requests. Any dependencies you need in the parsing environment will be injected into the :ws-net entry in the parsing env. In other words: this function makes the channel server depend on your stated dependencies, and the channel server itself appears under :ws-net in the parsing env. Thus, any injected dependencies will be there as well.
Params:
handshake-data-fn
(Optional) - Used by sente for adding data at the handshake.server-adapter
(Optional) - adapter for handling servers implemented by sente. Default is http-kit.client-id-fn
(Optional) - returns a client id from the request.dependencies
(Optional) - adds dependecies to the :ws-net entry in the parsing environment.valid-client-id-fn
(Optional) - Function for validating websocket clients. Expects a client-id.transit-handlers
(Optional) - Expects a map with :read
and/or :write
key containing a map of transit handlers,Creates a channel server that uses the default server parser (you can use defmutation, defquery-root, etc.) for incoming requests. Any dependencies you need in the parsing environment will be injected into the :ws-net entry in the parsing env. In other words: this function makes the channel server depend on your stated dependencies, and the channel server itself appears under :ws-net in the parsing env. Thus, any injected dependencies will be there as well. Params: - `handshake-data-fn` (Optional) - Used by sente for adding data at the handshake. - `server-adapter` (Optional) - adapter for handling servers implemented by sente. Default is http-kit. - `client-id-fn` (Optional) - returns a client id from the request. - `dependencies` (Optional) - adds dependecies to the :ws-net entry in the parsing environment. - `valid-client-id-fn` (Optional) - Function for validating websocket clients. Expects a client-id. - `transit-handlers` (Optional) - Expects a map with `:read` and/or `:write` key containing a map of transit handlers,
(valid-client-id? client-id)
Validate that the client id is a guid.
Validate that the client id is a guid.
(valid-origin? config request)
Validates origin based on a collection of whitelisted origin strings received from the config
at :ws-origin-whitelist
.
Validates origin based on a collection of whitelisted origin strings received from the config at `:ws-origin-whitelist`.
(wrap-web-socket handler)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close