getting data transformation with pub sub, although just need to solidify with more flow and just do it step by step as it can get complex
This commit is contained in:
@@ -3,6 +3,8 @@ import SocketChannels, {
|
||||
SomeoneConnected,
|
||||
SomeoneTuned,
|
||||
TuneToLine,
|
||||
UserBroadcastPull,
|
||||
UserBroadcastingPush,
|
||||
} from "@nirvana/core/sockets/channels";
|
||||
|
||||
import GetAllSocketClients from "@nirvana/core/sockets/getAllActiveSocketClients";
|
||||
@@ -95,6 +97,19 @@ export default function InitializeWs(io: any) {
|
||||
);
|
||||
});
|
||||
|
||||
/** BROADCAST UPDATE | tell all who are connected to line, not just tuned into, that there is an update to someone broadcasting */
|
||||
socket.on(
|
||||
SocketChannels.USER_BROADCAST_PUSH_PULL,
|
||||
(req: UserBroadcastingPush) => {
|
||||
const roomName = `connectedLine:${req.lineId}`;
|
||||
|
||||
io.in(roomName).emit(
|
||||
SocketChannels.USER_BROADCAST_PUSH_PULL,
|
||||
new UserBroadcastPull(req.lineId, userInfo.userId, req.isTurningOn)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
socket.on(SocketChannels.JOIN_LIVE_ROOM, async () => {
|
||||
// TODO: only get the socket ids of the relevant rooms for this user
|
||||
// return all Socket instances
|
||||
|
||||
Reference in New Issue
Block a user