-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ISSUE_UPDATED event and improve event handling
This commit includes the addition of the ISSUE_UPDATED event in the socket handler together with enhanced event emission. Socket event handling has been optimized to unwrap the event responsibility from BOARD_UPDATED and ISSUE_UPDATED specific events to a more general emitEvent function. Also, to prevent memory leaks, appropriate clean-up actions have been added for the socket event listener in the frontend services.
- Loading branch information
1 parent
a71fbef
commit a88c6c5
Showing
4 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
export const TYPE_BOARD_UPDATED = 'BOARD_UPDATED'; | ||
export const TYPE_ISSUE_UPDATED = 'ISSUE_UPDATED'; | ||
|
||
const room = 'general'; | ||
|
||
export const emitBoardUpdatedEvent = (io, data) => { | ||
const message = { | ||
type: TYPE_BOARD_UPDATED, | ||
const emitEvent = (io, type, data) => { | ||
io.to(room).emit('message', { | ||
type, | ||
data, | ||
}; | ||
}); | ||
}; | ||
|
||
export const emitBoardUpdatedEvent = (io, data) => { | ||
emitEvent(io, TYPE_BOARD_UPDATED, data); | ||
}; | ||
|
||
io.to(room).emit('message', message); | ||
export const emitIssueUpdatedEvent = (io, data) => { | ||
emitEvent(io, TYPE_ISSUE_UPDATED, data); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters