Fixing missing uuid in back
This commit is contained in:
parent
4c1e566a6c
commit
5a0dfdb1d5
@ -4,7 +4,7 @@ import grpc from "grpc";
|
|||||||
import {roomManager} from "./src/RoomManager";
|
import {roomManager} from "./src/RoomManager";
|
||||||
import {IRoomManagerServer, RoomManagerService} from "./src/Messages/generated/messages_grpc_pb";
|
import {IRoomManagerServer, RoomManagerService} from "./src/Messages/generated/messages_grpc_pb";
|
||||||
|
|
||||||
//App.listen(8080, () => console.log(`WorkAdventure starting on port 8080!`))
|
App.listen(8080, () => console.log(`WorkAdventure starting on port 8080!`))
|
||||||
|
|
||||||
const server = new grpc.Server();
|
const server = new grpc.Server();
|
||||||
server.addService<IRoomManagerServer>(RoomManagerService, roomManager);
|
server.addService<IRoomManagerServer>(RoomManagerService, roomManager);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
// lib/app.ts
|
// lib/app.ts
|
||||||
import {IoSocketController} from "./Controller/IoSocketController"; //TODO fix import by "_Controller/..."
|
|
||||||
import {AuthenticateController} from "./Controller/AuthenticateController"; //TODO fix import by "_Controller/..."
|
import {AuthenticateController} from "./Controller/AuthenticateController"; //TODO fix import by "_Controller/..."
|
||||||
import {MapController} from "./Controller/MapController";
|
import {MapController} from "./Controller/MapController";
|
||||||
import {PrometheusController} from "./Controller/PrometheusController";
|
import {PrometheusController} from "./Controller/PrometheusController";
|
||||||
@ -9,10 +8,9 @@ import {App as uwsApp} from "./Server/sifrr.server";
|
|||||||
|
|
||||||
class App {
|
class App {
|
||||||
public app: uwsApp;
|
public app: uwsApp;
|
||||||
public ioSocketController: IoSocketController;
|
//public authenticateController: AuthenticateController;
|
||||||
public authenticateController: AuthenticateController;
|
//public fileController: FileController;
|
||||||
public fileController: FileController;
|
//public mapController: MapController;
|
||||||
public mapController: MapController;
|
|
||||||
public prometheusController: PrometheusController;
|
public prometheusController: PrometheusController;
|
||||||
private debugController: DebugController;
|
private debugController: DebugController;
|
||||||
|
|
||||||
@ -20,10 +18,9 @@ class App {
|
|||||||
this.app = new uwsApp();
|
this.app = new uwsApp();
|
||||||
|
|
||||||
//create socket controllers
|
//create socket controllers
|
||||||
this.ioSocketController = new IoSocketController(this.app);
|
//this.authenticateController = new AuthenticateController(this.app);
|
||||||
this.authenticateController = new AuthenticateController(this.app);
|
//this.fileController = new FileController(this.app);
|
||||||
this.fileController = new FileController(this.app);
|
//this.mapController = new MapController(this.app);
|
||||||
this.mapController = new MapController(this.app);
|
|
||||||
this.prometheusController = new PrometheusController(this.app);
|
this.prometheusController = new PrometheusController(this.app);
|
||||||
this.debugController = new DebugController(this.app);
|
this.debugController = new DebugController(this.app);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {ADMIN_API_TOKEN} from "../Enum/EnvironmentVariable";
|
import {ADMIN_API_TOKEN} from "../Enum/EnvironmentVariable";
|
||||||
import {IoSocketController} from "_Controller/IoSocketController";
|
|
||||||
import {stringify} from "circular-json";
|
import {stringify} from "circular-json";
|
||||||
import {HttpRequest, HttpResponse} from "uWebSockets.js";
|
import {HttpRequest, HttpResponse} from "uWebSockets.js";
|
||||||
import { parse } from 'query-string';
|
import { parse } from 'query-string';
|
||||||
import {App} from "../Server/sifrr.server";
|
import {App} from "../Server/sifrr.server";
|
||||||
import {socketManager} from "../Services/SocketManager";
|
import {socketManager} from "../Services/SocketManager";
|
||||||
|
import {ServerWritableStream} from "grpc";
|
||||||
|
|
||||||
export class DebugController {
|
export class DebugController {
|
||||||
constructor(private App : App) {
|
constructor(private App : App) {
|
||||||
@ -23,6 +23,15 @@ export class DebugController {
|
|||||||
return res.writeStatus('200 OK').writeHeader('Content-Type', 'application/json').end(stringify(
|
return res.writeStatus('200 OK').writeHeader('Content-Type', 'application/json').end(stringify(
|
||||||
socketManager.getWorlds(),
|
socketManager.getWorlds(),
|
||||||
(key: unknown, value: unknown) => {
|
(key: unknown, value: unknown) => {
|
||||||
|
if (key === 'listeners') {
|
||||||
|
return 'Listeners';
|
||||||
|
}
|
||||||
|
if (key === 'socket') {
|
||||||
|
return 'Socket';
|
||||||
|
}
|
||||||
|
if (key === 'batchedMessages') {
|
||||||
|
return 'BatchedMessages';
|
||||||
|
}
|
||||||
if(value instanceof Map) {
|
if(value instanceof Map) {
|
||||||
const obj: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
const obj: any = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||||
for (const [mapKey, mapValue] of value.entries()) {
|
for (const [mapKey, mapValue] of value.entries()) {
|
||||||
|
@ -95,10 +95,9 @@ export class SocketManager implements ZoneEventListener {
|
|||||||
const position = client.position;
|
const position = client.position;
|
||||||
const viewport = client.viewport;
|
const viewport = client.viewport;
|
||||||
try {
|
try {
|
||||||
// TODO: do we need this.sockets anymore?
|
|
||||||
this.sockets.set(client.userId, client); //todo: should this be at the end of the function?
|
|
||||||
|
|
||||||
const joinRoomMessage = new JoinRoomMessage();
|
const joinRoomMessage = new JoinRoomMessage();
|
||||||
|
joinRoomMessage.setUseruuid(client.userUuid);
|
||||||
joinRoomMessage.setRoomid(client.roomId);
|
joinRoomMessage.setRoomid(client.roomId);
|
||||||
joinRoomMessage.setName(client.name);
|
joinRoomMessage.setName(client.name);
|
||||||
joinRoomMessage.setPositionmessage(ProtobufUtils.toPositionMessage(client.position));
|
joinRoomMessage.setPositionmessage(ProtobufUtils.toPositionMessage(client.position));
|
||||||
@ -121,6 +120,10 @@ export class SocketManager implements ZoneEventListener {
|
|||||||
|
|
||||||
streamToPusher.on('data', (message: ServerToClientMessage) => {
|
streamToPusher.on('data', (message: ServerToClientMessage) => {
|
||||||
if (message.hasRoomjoinedmessage()) {
|
if (message.hasRoomjoinedmessage()) {
|
||||||
|
client.userId = (message.getRoomjoinedmessage() as RoomJoinedMessage).getCurrentuserid();
|
||||||
|
// TODO: do we need this.sockets anymore?
|
||||||
|
this.sockets.set(client.userId, client);
|
||||||
|
|
||||||
// If this is the first message sent, send back the viewport.
|
// If this is the first message sent, send back the viewport.
|
||||||
this.handleViewport(client, viewport);
|
this.handleViewport(client, viewport);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user