DFreds
DFreds
Sockets not emitting
Hey all, I'm losing my mind. I recently stopped using socketlib in my convenient effects rewrite, and now I can't get sockets to emit at all. My setup is basically copying how pf2e did it, so I'm a bit confused. And yes, socket: true is set in the manifest. Here's my code (again, mostly derived from pf2e):
Hooks.once("init", () => {
activateSocketListener();
});
Hooks.once("init", () => {
activateSocketListener();
});
function activateSocketListener(): void {
game.socket.on(
SocketEffectHandler.IDENTIFIER,
async (...[message, userId]: SocketEventParams) => {
log(`Socket emitted ${message} ${userId}`);
},
);
}
function activateSocketListener(): void {
game.socket.on(
SocketEffectHandler.IDENTIFIER,
async (...[message, userId]: SocketEventParams) => {
log(`Socket emitted ${message} ${userId}`);
},
);
}
async removeEffect({
effectId,
effectName,
uuid,
origin,
}: IRemoveEffect): Promise<void> {
game.socket.emit(SocketEffectHandler.IDENTIFIER, {
request: "removeEffect",
effectId,
effectName,
uuid,
origin,
} satisfies SocketMessage);
}
async removeEffect({
effectId,
effectName,
uuid,
origin,
}: IRemoveEffect): Promise<void> {
game.socket.emit(SocketEffectHandler.IDENTIFIER, {
request: "removeEffect",
effectId,
effectName,
uuid,
origin,
} satisfies SocketMessage);
}
class SocketEffectHandler {
static IDENTIFIER = `module.${MODULE_ID}`;
// ... omit rest
}
class SocketEffectHandler {
static IDENTIFIER = `module.${MODULE_ID}`;
// ... omit rest
}
Basically I'm never seeing the log come through from the on call
9 replies