feat(core): Initial support for two-way communication over websockets (#7570)

- Enable two-way communication with web sockets
- Enable sending push messages to specific users
- Add collaboration service for managing active users for workflow

Missing things:
- State is currently kept only in memory, making this not work in
multi-master setups
- Removing a user from active users in situations where they go inactive
or we miss the "workflow closed" message
- I think a timer based solution for this would cover most edge cases.
I.e. have FE ping every X minutes, BE removes the user unless they have
received a ping in Y minutes, where Y > X
- FE changes to be added later by @MiloradFilipovic 

Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Tomi Turtiainen
2023-11-07 17:26:45 +02:00
committed by GitHub
parent a3a26109c6
commit ac877014ed
14 changed files with 641 additions and 45 deletions

View File

@@ -129,7 +129,7 @@ export class CommunityPackagesController {
// broadcast to connected frontends that node list has been updated
installedPackage.installedNodes.forEach((node) => {
this.push.send('reloadNodeType', {
this.push.broadcast('reloadNodeType', {
name: node.type,
version: node.latestVersion,
});
@@ -218,7 +218,7 @@ export class CommunityPackagesController {
// broadcast to connected frontends that node list has been updated
installedPackage.installedNodes.forEach((node) => {
this.push.send('removeNodeType', {
this.push.broadcast('removeNodeType', {
name: node.type,
version: node.latestVersion,
});
@@ -257,14 +257,14 @@ export class CommunityPackagesController {
// broadcast to connected frontends that node list has been updated
previouslyInstalledPackage.installedNodes.forEach((node) => {
this.push.send('removeNodeType', {
this.push.broadcast('removeNodeType', {
name: node.type,
version: node.latestVersion,
});
});
newInstalledPackage.installedNodes.forEach((node) => {
this.push.send('reloadNodeType', {
this.push.broadcast('reloadNodeType', {
name: node.name,
version: node.latestVersion,
});
@@ -283,7 +283,7 @@ export class CommunityPackagesController {
return newInstalledPackage;
} catch (error) {
previouslyInstalledPackage.installedNodes.forEach((node) => {
this.push.send('removeNodeType', {
this.push.broadcast('removeNodeType', {
name: node.type,
version: node.latestVersion,
});