Hi guys,

> (sente/chsk-reconnect! <my-chsk>) to disconnect (and then reconnect) a 
connection.

Yup, you can call `chsk-reconnect!` from the client to reset its 
connections. This is useful mostly for picking up possible session changes 
after authentication, etc.

There isn't currently a client-side `disconnect!` fn, but it'd be trivial 
to add (GitHub issue/PR welcome).


> I think you can send :chsk/close:

Yeah, Sam's right (thanks Sam!). The server can send a `[:chsk/close]` 
event to a user-id to have all of those user's connections terminated. If 
any clients are still active though, they'll just automatically attempt to 
reconnect again.

You'd normally send this event during the server's normal procedure to 
logout+cleanup a user.


> It seems that both chsk-reconnect! and :chsk/close events will let the 
client control its connection state, but there doesn't seem to be any way 
for the server to do so.

Note that the `[:chsk/close]` special event is issued from the server, not 
the client. Reason it isn't documented yet is that it's still subject to 
change and may actually be dropped in future. Any change to the current 
behaviour will be listed in the CHANGELOG though.


> Still, I'd like the server to be able to sever connections, although its 
not a big deal since I can have the server send an event to tell the client 
to do so.

Sure. One minor clarification: Sente intentionally decouples the notion of 
connection status and intention. It'll never assume that a dropped 
connection is _intentional_ - so it'll always try to recover.

Connections come and go. It's the (higher-level) channel socket that you 
must close to convey that you're done with all comms and don't want any 
more connections. The (higher-level) channel socket can only be closed 
intentionally, it won't ever close due to changing network conditions, etc.

Clients can indicate that they're done with all comms with a 
`(chsk/disconnect! <client-chsk>)` call.

To do this from the server's end, the server may send some notification 
event to a user's clients - and those clients may choose to honour the 
termination request with `(chsk/disconnect! <client-chsk>)` calls.

Does that make sense?

So it sounds like the client-side `disconnect!` fn is what you want. Again 
- issues/PR welcome! Otherwise will try get this in by Wednesday, just busy 
juggling some urgent tasks.

Cheers! :-)

>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to