Add barebone to support socket.io

(This is more a temp commit to update the frontend)
This commit is contained in:
2021-05-06 15:24:20 +02:00
parent 533749c7c8
commit 9f1aa50681
16 changed files with 26370 additions and 3185 deletions

63
backend/.idea/workspace.xml generated Normal file
View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="19050b14-6aa3-4201-be2a-b6c9fb417ff6" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../android/app/src/main/java/de/nicolasklier/livebeat/MainActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/../android/app/src/main/java/de/nicolasklier/livebeat/MainActivity.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.ts" beforeDir="false" afterPath="$PROJECT_DIR$/app.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config.ts" beforeDir="false" afterPath="$PROJECT_DIR$/config.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/endpoints/beat.ts" beforeDir="false" afterPath="$PROJECT_DIR$/endpoints/beat.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/endpoints/phone.ts" beforeDir="false" afterPath="$PROJECT_DIR$/endpoints/phone.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/rabbit.ts" beforeDir="false" afterPath="$PROJECT_DIR$/lib/rabbit.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/api.service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/api.service.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/map.worker.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/map.worker.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/map/map.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/map/map.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/../package-lock.json" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
</component>
<component name="ProjectId" id="1qRNQeCqRVVNuS6QKJoYRrUYOnM" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="19050b14-6aa3-4201-be2a-b6c9fb417ff6" name="Default Changelist" comment="" />
<created>1617038467045</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1617038467045</updated>
<workItem from="1617038468601" duration="1438000" />
<workItem from="1617121449363" duration="83000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
</project>

View File

@@ -1,5 +1,3 @@
import * as amqp from 'amqplib';
import { Schema, SchemaType } from 'mongoose';
import { logger, RABBITMQ_URI } from '../app';
import { Beat } from '../models/beat/beat.model.';
import { ISeverity, NotificationType } from '../models/notifications/notification.interface';

24
backend/lib/socketio.ts Normal file
View File

@@ -0,0 +1,24 @@
import * as socketio from "socket.io";
/**
* This class handles all SocketIO connections.
*
* *SocketIO is another layer ontop of WebSockets*
*/
class SocketManager {
io: socketio.Server;
express: Express.Application;
constructor (express: Express.Application) {
this.io = new socketio.Server(express);
this.express = express;
}
init() {
this.io.on('connect', data => {
console.log('New connection')
});
}
}

4231
backend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,7 @@
"license": "GPL-3.0-or-later",
"dependencies": {
"@types/node": "^14.14.9",
"@types/socket.io": "^2.1.13",
"amqplib": "^0.6.0",
"argon2": "^0.27.0",
"body-parser": "^1.19.0",
@@ -29,25 +30,26 @@
"jsonwebtoken": "^8.5.1",
"moment": "^2.29.1",
"mongoose": "^5.10.9",
"socket.io": "^4.0.1",
"ts-node": "^9.0.0",
"typescript": "^4.0.3",
"winston": "^3.3.3"
},
"devDependencies": {
"@types/amqplib": "0.5.14",
"@types/argon2": "0.15.0",
"@types/body-parser": "1.19.0",
"@types/chalk": "2.2.0",
"@types/cors": "2.8.8",
"@types/dotenv": "8.2.0",
"@types/express": "4.17.8",
"@types/figlet": "1.2.0",
"@types/jsonwebtoken": "8.5.0",
"@types/moment": "2.13.0",
"@types/mongoose": "5.7.36",
"@types/typescript": "2.0.0",
"@types/winston": "2.4.4",
"concurrently": "^5.3.0",
"nodemon": "^2.0.5",
"@types/jsonwebtoken": "8.5.0",
"@types/amqplib": "0.5.14",
"@types/cors": "2.8.8",
"@types/moment": "2.13.0"
"nodemon": "^2.0.5"
}
}