add authenticate on socket connect
This commit is contained in:
parent
4a9e19bb43
commit
e0da50eb27
7 changed files with 112 additions and 70 deletions
|
|
@ -14,12 +14,6 @@ interface ipcRendererPayload {
|
|||
*/
|
||||
export function main(): void {
|
||||
|
||||
// Instantiate socket session with crimata-platorm.
|
||||
initSession();
|
||||
|
||||
// mount auth-user listener
|
||||
ipcMain.on('auth-user', authUser);
|
||||
|
||||
// create main window.
|
||||
const win = createWindow({ width: 350, height: 525, resizable: false });
|
||||
|
||||
|
|
@ -34,18 +28,17 @@ export function main(): void {
|
|||
}
|
||||
|
||||
const windowMount = (): void => {
|
||||
// Instantiate socket session with crimata-platorm.
|
||||
initSession();
|
||||
windowEmitter.emit('window-active', true);
|
||||
// ipc event handlers
|
||||
ipcMain.on('send-message', handleMessage);
|
||||
ipcMain.on('auth-login', authLogin);
|
||||
}
|
||||
|
||||
const windowDismount = (): void => {
|
||||
windowEmitter.emit('window-active', false);
|
||||
// TODO: Gracefully close socket connection
|
||||
ipcMain.removeAllListeners('send-message');
|
||||
ipcMain.removeAllListeners('auth-login');
|
||||
ipcMain.removeAllListeners('auth-user');
|
||||
}
|
||||
|
||||
// Handle window mount and dismount.
|
||||
|
|
|
|||
Loading…
Reference in a new issue