|
825 | 825 | (recur udt-t1))))))
|
826 | 826 |
|
827 | 827 | ;; Ajax handshake/poll
|
828 |
| - (let [updated-conn (upd-conn! :ajax uid client-id :any server-ch) |
829 |
| - udt-open (:udt updated-conn) |
830 |
| - send-handshake? (or (:init? updated-conn) (:handshake? params))] |
| 828 | + (let [send-handshake? |
| 829 | + (or |
| 830 | + (:handshake? params) |
| 831 | + (nil? (get-in @conns_ [:ajax uid client-id])))] |
831 | 832 |
|
832 | 833 | (timbre/logf (if send-handshake? :info :trace)
|
833 | 834 | "[ajax/on-open] New server Ajax sch (poll/handshake) for %s: %s"
|
834 | 835 | (lid uid client-id)
|
835 | 836 | {:send-handshake? send-handshake?})
|
836 | 837 |
|
837 |
| - (when (connect-uid! :ajax uid) |
838 |
| - (receive-event-msg! [:chsk/uidport-open uid])) |
839 |
| - |
840 | 838 | (if send-handshake?
|
841 | 839 | ;; Client will immediately repoll
|
842 | 840 | (send-handshake! server-ch websocket?)
|
843 | 841 |
|
844 |
| - (when-let [ms lp-timeout-ms] |
845 |
| - (go |
846 |
| - (<! (async/timeout ms)) |
847 |
| - (when-let [[sch udt-t1] (get-in @conns_ [:ajax uid client-id])] |
848 |
| - (when (and (= identical? server-ch) (= udt-t1 udt-open)) |
849 |
| - (interfaces/sch-send! server-ch websocket? |
850 |
| - (pack packer :chsk/timeout)))))))))) |
| 842 | + (let [updated-conn (upd-conn! :ajax uid client-id :any server-ch) |
| 843 | + udt-open (:udt updated-conn)] |
| 844 | + (when-let [ms lp-timeout-ms] |
| 845 | + (go |
| 846 | + (<! (async/timeout ms)) |
| 847 | + (when-let [[sch udt-t1] (get-in @conns_ [:ajax uid client-id])] |
| 848 | + (when (and (= identical? server-ch) (= udt-t1 udt-open)) |
| 849 | + (interfaces/sch-send! server-ch websocket? |
| 850 | + (pack packer :chsk/timeout)))))))) |
| 851 | + |
| 852 | + (when (connect-uid! :ajax uid) |
| 853 | + (receive-event-msg! [:chsk/uidport-open uid]))))) |
851 | 854 |
|
852 | 855 | :on-msg
|
853 | 856 | (fn [server-ch websocket? req-ppstr]
|
|
0 commit comments