taoensso / sente

Realtime web comms library for Clojure/Script
https://www.taoensso.com/sente
Eclipse Public License 1.0
1.74k stars 193 forks source link

What's the proper way to re-establish clean connection on server restart? #368

Closed rlhk closed 4 years ago

rlhk commented 4 years ago

From all example projects, it seems the only way is to refresh the browser. What's the recommended way to do so programmatically?

I tried putting (make-channel-socket! ... and (sente/start-client-chsk-router! ... in atoms. By running the stop-fn as well as reset! the atoms to nil, I keep seeing Chsk send against closed chsk and Chsk is closed: will try reconnect ...

After remaking the channel-socket and router, there will be 2 client-ids trying to establish connection but neither will succeed.

The questions are:

  1. Should I expect auto reconnection on server down and up?
  2. If not, what should be done on client side to handle reconnection? (Except refresh)
rlhk commented 4 years ago

Was able to fix the client-id duplication issue by closing :ch-recv before remaking channel socking. However the 2 questions remain.

rlhk commented 4 years ago

Apparently it's a csrf issue. :]