-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
575 additions
and
53 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
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,2 +1,3 @@ | ||
export { SOCKET_TRANSPORT_WEBSOCKETS } from './socket-trasnport.constants.js'; | ||
export { USER_PASSWORD_SALT_ROUNDS } from './user.constants.js'; | ||
export { WHITE_ROUTES } from './white-routes.constants.js'; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const SOCKET_TRANSPORT_WEBSOCKETS = 'websocket'; | ||
|
||
export { SOCKET_TRANSPORT_WEBSOCKETS }; |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const AvatarVideoEvent = { | ||
RENDER_SUCCESS: 'render:success', | ||
RENDER_FAILED: 'render:failed', | ||
} as const; | ||
|
||
export { AvatarVideoEvent }; |
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,2 +1,4 @@ | ||
export { AvatarVideoEvent } from './avatar-video-event.enum.js'; | ||
export { ParametersValidationMessage } from './parameters-validation-message.enum.js'; | ||
export { SocketEvent } from './socket-event.enum.js'; | ||
export { ApiPath, AppEnvironment, ServerErrorType } from 'shared'; |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const SocketEvent = { | ||
CONNECTION: 'connection', | ||
DISCONNECT: 'disconnect', | ||
} as const; | ||
|
||
export { SocketEvent }; |
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
12 changes: 12 additions & 0 deletions
12
backend/src/common/server-application/socket-application.ts
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { type Server, type Socket } from 'socket.io'; | ||
|
||
import { SocketEvent } from '../enums/enums.js'; | ||
import { socketEvent } from '../socket/socket.js'; | ||
|
||
const initSocketConnection = (io: Server, socket: Socket): void => { | ||
socketEvent.initSocketConnection(io, socket); | ||
|
||
socket.on(SocketEvent.DISCONNECT, () => {}); | ||
}; | ||
|
||
export { initSocketConnection }; |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import EventTarget from 'node:events'; | ||
|
||
import { type Server, type Socket } from 'socket.io'; | ||
|
||
class SocketEvent extends EventTarget { | ||
private io: Server | null = null; | ||
private socket: Socket | null = null; | ||
|
||
public initSocketConnection(io: Server, socket: Socket): void { | ||
this.io = io; | ||
this.socket = socket; | ||
} | ||
|
||
public getIo(): Server | null { | ||
return this.io; | ||
} | ||
|
||
public getSocket(): Socket | null { | ||
return this.socket; | ||
} | ||
|
||
public emitNotification(event: string): void { | ||
if (this.socket) { | ||
this.socket.emit(event); | ||
} | ||
} | ||
} | ||
|
||
const socketEvent = new SocketEvent(); | ||
|
||
export { socketEvent }; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { socketEvent } from './scoket-event.js'; |
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,2 +1,3 @@ | ||
export { FPS } from './fps.constant.js'; | ||
export { SOCKET_TRANSPORT_WEBSOCKETS } from './socket-trasnport.constants.js'; | ||
export { EMPTY_VALUE } from 'shared'; |
3 changes: 3 additions & 0 deletions
3
frontend/src/bundles/common/constants/socket-trasnport.constants.ts
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const SOCKET_TRANSPORT_WEBSOCKETS = 'websocket'; | ||
|
||
export { SOCKET_TRANSPORT_WEBSOCKETS }; |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { type Socket, io } from 'socket.io-client'; | ||
|
||
import { SOCKET_TRANSPORT_WEBSOCKETS } from '~/bundles/common/constants/constants.js'; | ||
|
||
const serverUrl = import.meta.env['VITE_APP_PROXY_SERVER_URL']; | ||
|
||
const socket = io(serverUrl, { | ||
// This is to ensure that it dosent fall back to long polling as it return a 404 if it does | ||
transports: [SOCKET_TRANSPORT_WEBSOCKETS], | ||
}); | ||
const SocketContext = React.createContext<Socket>(socket); | ||
|
||
export { socket, SocketContext }; |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const AvatarVideoEvent = { | ||
RENDER_SUCCESS: 'render:success', | ||
RENDER_FAILED: 'render:failed', | ||
} as const; | ||
|
||
export { AvatarVideoEvent }; |
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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { VIDEO_RENDER_FAILED_NOTIFICATION_ID } from './video-render-failed-notification-id.constant.js'; | ||
export { VIDEO_RENDER_SUCCESS_NOTIFICATION_ID } from './video-render-success-notification-id.constant.js'; |
3 changes: 3 additions & 0 deletions
3
frontend/src/bundles/home/constants/video-render-failed-notification-id.constant.ts
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const VIDEO_RENDER_FAILED_NOTIFICATION_ID = 'video-render-failed'; | ||
|
||
export { VIDEO_RENDER_FAILED_NOTIFICATION_ID }; |
3 changes: 3 additions & 0 deletions
3
frontend/src/bundles/home/constants/video-render-success-notification-id.constant.ts
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const VIDEO_RENDER_SUCCESS_NOTIFICATION_ID = 'video-render-success'; | ||
|
||
export { VIDEO_RENDER_SUCCESS_NOTIFICATION_ID }; |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { NotificationMessage } from './notification-message.enum.js'; | ||
export { NotificationTitle } from './notification-title.enum.js'; |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const NotificationMessage = { | ||
VIDEO_RENDER_SUCCESS: 'Video rendered successfully', | ||
VIDEO_RENDER_FAILED: 'Video render failed', | ||
} as const; | ||
|
||
export { NotificationMessage }; |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const NotificationTitle = { | ||
VIDEO_RENDER_SUCCESS: 'Video rendered', | ||
VIDEO_RENDER_FAILED: 'Video render failed', | ||
} as const; | ||
|
||
export { NotificationTitle }; |
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
Oops, something went wrong.