Skip to content

Commit

Permalink
chore(deps): add src/* to pnpm-workspace.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
drazisil committed Sep 15, 2024
1 parent 2616b49 commit a7de5bb
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
packages:
- 'packages/*'
- "src/*"
46 changes: 46 additions & 0 deletions src/chat/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {
GameMessage,
getServerLogger,
type ServiceResponse,
} from "rusty-motors-shared";
import type { Serializable } from "rusty-motors-shared-packets";

/**
* Receive chat data
*
* @param connectionId - Connection ID
* @param message - Message
* @returns Service response
*/
async function receiveChatData({
connectionId,
message,
}: {
connectionId: string;
message: Serializable;
}): Promise<ServiceResponse> {
const log = getServerLogger({});

log.info(`Received chat data from connection ${connectionId}`);
log.debug(`Message: ${message.toHexString()}`);

const inboundMessage = new GameMessage(0);
inboundMessage.deserialize(message.serialize());

log.debug(`Deserialized message: ${inboundMessage.toHexString()}`);

const id = inboundMessage._header.id;

log.debug(`Message ID: ${id}`);

throw new Error(
`Unable to process chat data from connection ${connectionId}, data: ${message.toHexString()}`,
);

return {
connectionId,
messages: [],
};
}

export { receiveChatData };

0 comments on commit a7de5bb

Please sign in to comment.