Define Tuck events that are sent to the server.
Define Tuck events that are sent to the server.
(define-client-event event-record-name)
(define-client-event event-record-name constructor)
Define event record that the server can send to the client. The must be previously defined record type.
Define event record that the server can send to the client. The must be previously defined record type.
(define-server-event event-record-name options)
Define an event record that is automatically sent to the server.
event-record-name
must be a symbol defining the event name.options
is a map of parametersThe event is sent to the server. If the server is expected to send some other event as a reply to this event, a timeout may be specified. By default, no timeout is applied.
Each event has an id (sequence number). If event-id-path
is set, the id of the
sent event will be assoc'ed to the app state at that path. This is useful for
example for showing a loading indicator in the client.
Supported options:
timeout
number of milliseconds to wait for server to send a responseon-timeout
a symbol denoting an event record to send if no response is receivedevent-id-path
a vector denoting a path in the app state to set the event id toDefine an event record that is automatically sent to the server. - `event-record-name` must be a symbol defining the event name. - `options` is a map of parameters The event is sent to the server. If the server is expected to send some other event as a reply to this event, a timeout may be specified. By default, no timeout is applied. Each event has an id (sequence number). If `event-id-path` is set, the id of the sent event will be assoc'ed to the app state at that path. This is useful for example for showing a loading indicator in the client. Supported options: - `timeout` number of milliseconds to wait for server to send a response - `on-timeout` a symbol denoting an event record to send if no response is received - `event-id-path` a vector denoting a path in the app state to set the event id to
(initialize-client! ws-url app-atom on-connect)
Initialize Tuck remoting client. Takes the websocket URL and the app state atom to apply received events against.
Must be called before any events can be sent.
Initialize Tuck remoting client. Takes the websocket URL and the app state atom to apply received events against. Must be called before any events can be sent.
(send-event! event)
Send event to Tuck remoting WS server. Returns event id.
Send event to Tuck remoting WS server. Returns event id.
(process-event this client server-state)
Process this event received from the client and return new server state.
client
is map describing the client who sent this event.
context
is the user defined server context
Process this event received from the client and return new server state. `client` is map describing the client who sent this event. `context` is the user defined server context
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close