Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): socket pushes not working #82

Merged
merged 13 commits into from
Mar 28, 2022
6 changes: 3 additions & 3 deletions modules/chat/src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export class ChatRoutes {
return 'Message updated successfully';
}

async connect(call: ParsedSocketRequest) {
async connect(call: ParsedSocketRequest): Promise<UnparsedSocketResponse> {
const { user } = call.request.context;
const rooms = await ChatRoom.getInstance()
.findMany({ participants: user._id });
Expand All @@ -299,7 +299,7 @@ export class ChatRoutes {

async onMessage(call: ParsedSocketRequest): Promise<UnparsedSocketResponse> {
const { user } = call.request.context;
const [roomId, message] = call.request.params;
const { roomId, message } = call.request.params;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be [ roomId, message ]. Socket params are an array.

const room = await ChatRoom.getInstance().findOne({ _id: roomId });

if (isNil(room) || !(room as ChatRoom).participants.includes(user._id)) {
Expand All @@ -323,7 +323,7 @@ export class ChatRoutes {

async onMessagesRead(call: ParsedSocketRequest): Promise<UnparsedSocketResponse> {
const { user } = call.request.context;
const [roomId] = call.request.params;
const { roomId } = call.request.params;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same ^

const room = await ChatRoom.getInstance()
.findOne({ _id: roomId });
if (isNil(room) || !(room as ChatRoom).participants.includes(user._id)) {
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.