my power's back
All checks were successful
Galvanic Corrosion Cross-Compile / build (push) Successful in 1m57s
All checks were successful
Galvanic Corrosion Cross-Compile / build (push) Successful in 1m57s
* Steam authentication * Profile events * Objective fixes for some rooms (reccenter, goldentrophy, etc) * Profile meta (displayname) somewhat works * Player socket subscriptions
This commit is contained in:
@@ -34,6 +34,10 @@ import {
|
||||
import { SocketTarget } from "./targets/targetbase.ts";
|
||||
import { PlayerSocketSubscriptionTarget } from "./targets/SubscribeToPlayers.ts";
|
||||
import Presence from "../data/live/presence.ts";
|
||||
import Instances from "../data/live/instances.ts";
|
||||
import Matchmaking from "../data/live/base.ts";
|
||||
|
||||
const logmessages = true;
|
||||
|
||||
export class SignalRSocketHandler {
|
||||
|
||||
@@ -55,7 +59,7 @@ export class SignalRSocketHandler {
|
||||
|
||||
player.setSocketHandler(this);
|
||||
|
||||
this.#Targets.set('SubscribeToPlayers', new PlayerSocketSubscriptionTarget());
|
||||
this.#Targets.set('SubscribeToPlayers', new PlayerSocketSubscriptionTarget(this));
|
||||
|
||||
this.#PeriodicalId = setInterval(async () => {
|
||||
if (this.#socket.readyState !== this.#socket.CLOSED) {
|
||||
@@ -86,7 +90,7 @@ export class SignalRSocketHandler {
|
||||
this.sendRaw({});
|
||||
return;
|
||||
} else {
|
||||
//this.#log.d(`CLIENT MESSAGE\n Type: ${message.data.type} (${SignalMessageType[message.data.type]})\n ${JSON.stringify(message.data)}`);
|
||||
if (logmessages) this.#log.d(`CLIENT MESSAGE\n Type: ${message.data.type} (${SignalMessageType[message.data.type]})\n ${JSON.stringify(message.data)}`);
|
||||
if (message.data.type == SignalMessageType.Invocation && message.data.invocationId) { // don't send completion messages for nonblocking invocations
|
||||
const res = await this.#dispatchTarget(message.data.target, message.data.arguments[0]); // rec room only uses the first index
|
||||
if (res.type == TargetResultType.Success) {
|
||||
@@ -153,14 +157,21 @@ export class SignalRSocketHandler {
|
||||
if (!internal) sock.#socket.close();
|
||||
sock.#log.i(`Closed socket`);
|
||||
sock.#profile.clearSocketHandler();
|
||||
|
||||
for (const target of sock.#Targets.values()) target.destroy();
|
||||
|
||||
Instances.removePlayerFromCurrentInstance(this.#profile);
|
||||
Matchmaking.deleteLoginLock(this.#profile);
|
||||
}
|
||||
}
|
||||
|
||||
sendRaw(data: object) {
|
||||
this.#socket.send(`${JSON.stringify(data)}\u001e`);
|
||||
// todo sometime: make the below less confusing
|
||||
//const type = `Type: ${JSON.stringify(data) == '{}' ? 'Protocol Message' : `${(data as SignalRMessage).type} (${SignalMessageType[(data as SignalRMessage).type]})`}`;
|
||||
//this.#log.d(`SERVER MESSAGE\n ${type}\n ${JSON.stringify(data as SignalRMessage)}`);
|
||||
if (logmessages) {
|
||||
const type = `Type: ${JSON.stringify(data) == '{}' ? 'Protocol Message' : `${(data as SignalRMessage).type} (${SignalMessageType[(data as SignalRMessage).type]})`}`;
|
||||
this.#log.d(`SERVER MESSAGE\n ${type}\n ${JSON.stringify(data as SignalRMessage)}`);
|
||||
}
|
||||
}
|
||||
|
||||
sendNotification(id: PushNotificationId | string, args: object) {
|
||||
|
||||
Reference in New Issue
Block a user