Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add server->client send with cb + timeout support? #423

Open
ptaoussanis opened this issue Feb 28, 2023 · 1 comment
Open

Add server->client send with cb + timeout support? #423

ptaoussanis opened this issue Feb 28, 2023 · 1 comment

Comments

@ptaoussanis
Copy link
Member

ptaoussanis commented Feb 28, 2023

Current chsk-send! API:

  • Clients: (fn [event & [?timeout-ms ?cb-fn]])
  • Server: (fn [user-id event])

It may be useful to add a low-level (private?) server-side method like (fn [client-id event & [?timeout-ms ?cb-fn]]).

Uses include:

@shader
Copy link

shader commented Oct 18, 2023

I think I'd like to have something like this, since I think clients should be able to subscribe to some events separately.

Here's the use case / pattern I'm considering:

  • send "global events" to uid (notifications, chat messages, etc.)
  • send "local events" to specific client, e.g. update events for the object/document that the client is viewing. Different clients from the same user will likely be viewing and thus subscribed to different things.

I think it should be somewhat straightforward to factor out the "client-id sending" part from the "uid sending" and then call it directly, given a client-id.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants