change default subscriber-key to :client-id
This commit is contained in:
parent
03b81ce513
commit
dcf19c33e2
|
@ -49,7 +49,7 @@
|
||||||
* subscriber-key
|
* subscriber-key
|
||||||
Optional. A function applied against incoming BrowserChannel subscription messages
|
Optional. A function applied against incoming BrowserChannel subscription messages
|
||||||
that is used to get the client-id from the message. If not used, the default is
|
that is used to get the client-id from the message. If not used, the default is
|
||||||
:browserchannel-session-id.
|
:client-id.
|
||||||
|
|
||||||
* templates
|
* templates
|
||||||
Map of views used by this application. Keys are the view names and the values are maps
|
Map of views used by this application. Keys are the view names and the values are maps
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
([db templates & {:keys [persistence send-fn subscriber-key]}]
|
([db templates & {:keys [persistence send-fn subscriber-key]}]
|
||||||
(let [persistence (or persistence (new-memory-persistence))
|
(let [persistence (or persistence (new-memory-persistence))
|
||||||
send-fn (or send-fn send-deltas)
|
send-fn (or send-fn send-deltas)
|
||||||
subscriber-key (or subscriber-key :browserchannel-session-id)]
|
subscriber-key (or subscriber-key :client-id)]
|
||||||
(init! (-> {:db db
|
(init! (-> {:db db
|
||||||
:subscriber-key-fn subscriber-key
|
:subscriber-key-fn subscriber-key
|
||||||
:templates templates
|
:templates templates
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
^{:doc "Middleware for use with clj-browserchannel-messaging that performs important housekeeping operations."}
|
^{:doc "Middleware for use with clj-browserchannel-messaging that performs important housekeeping operations."}
|
||||||
views-middleware
|
views-middleware
|
||||||
{:on-close (fn [handler]
|
{:on-close (fn [handler]
|
||||||
(fn [browserchannel-session-id request reason]
|
(fn [client-id request reason]
|
||||||
; views.router is notified of session disconnects when messages of this type
|
; views.router is notified of session disconnects when messages of this type
|
||||||
; are received on the channel passed to views.router/init!. we simply
|
; are received on the channel passed to views.router/init!. we simply
|
||||||
; inject a disconnect message on this channel when the browserchannel session
|
; inject a disconnect message on this channel when the browserchannel session
|
||||||
|
@ -110,8 +110,8 @@
|
||||||
(put! browserchannel/incoming-messages
|
(put! browserchannel/incoming-messages
|
||||||
(-> {:topic :client-channel
|
(-> {:topic :client-channel
|
||||||
:body :disconnect}
|
:body :disconnect}
|
||||||
(assoc (:subscriber-key @views-config) browserchannel-session-id)))
|
(assoc (:subscriber-key @views-config) client-id)))
|
||||||
(handler browserchannel-session-id request reason)))})
|
(handler client-id request reason)))})
|
||||||
|
|
||||||
(defn get-subscribed-views
|
(defn get-subscribed-views
|
||||||
"Returns information about the views that are currently subscribed to by clients."
|
"Returns information about the views that are currently subscribed to by clients."
|
||||||
|
|
Loading…
Reference in a new issue