#[Mid+ Level] How to sync kanban board using websocket?

13 messages · Page 1 of 1 (latest)

plush iron
#

Use one connection per board that looks for changes and make the necessary changes to the board on change and when a task edited or created, you can use AJAX

#

You can send a payload with the board_id and then maybe have filtering done in the backend?

halcyon patio
#

[Mid+ Level] How to sync kanban board using websocket?

ripe ledge
#

Just have a user subscribed to a board channel. Whenever anything on the board updates send an event with what updated (TaskUpdated, CardUpdated, ColumnUpdated, etc). Then just refresh the item that updated

#

If that's the case why not just have a dedicated channel per user then? When something happens on your app your server will then get the event, figure out all users who should recieve said event, and broadcast the event on all the user channels

#

No harm in sending an event anyway right?

#

Maybe they change their view in between the time that you start broadcasting the event and they recieve it

#

Yeah I think that's fine. On a lot of websocket connections I've seen there are events being sent all the time that I may not actually "see" changes for

#

Or just something like :

Echo.private('App.User.' + userId)
    .notification((notification) => {
        console.log(notification.type);
    });
#

I'm not 100% sure as it would depend on how you set it up. Just throwing out ideas I've heard before

marsh timber
#

Why not broadcast the update events in a board channel, and then listen for the events when that component is loaded/viewed in the front end?

I always like to think of it as something like this:

  • backend sends events to related channels (specific or broadcast to all) or notifications to specific users
  • frontend will listen to the broadcasts where and when they are needed. And then is responsible for doing something with it.

For me it's oké to broadcast and then have the frontend miss it, when for example the user is not viewing that part of the app, when I make sure to (re)load the contents upon the next load/view. If you want you could (re)load in the background, but that all depends on your setup and type of broadcast.

#

Hope this helps, feel free to clarify more if there's anything specific you're running into with this

zenith spindle