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

Core: Fix channelOptions for serverChannel #23615

Merged
merged 6 commits into from
Jul 27, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions code/lib/core-server/src/utils/get-server-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export class ServerChannelTransport {
this.socket.on('connection', (wss) => {
wss.on('message', (raw) => {
const data = raw.toString();
const event = typeof data === 'string' && isJSON(data) ? parse(data) : data;
const event =
typeof data === 'string' && isJSON(data)
? parse(data, { allowFunction: false, allowClass: false })
: data;
this.handler?.(event);
});
});
Expand All @@ -38,7 +41,7 @@ export class ServerChannelTransport {
}

send(event: any) {
const data = stringify(event, { maxDepth: 15, allowFunction: true });
const data = stringify(event, { maxDepth: 15, allowFunction: false, allowClass: false });

Array.from(this.socket.clients)
.filter((c) => c.readyState === WebSocket.OPEN)
Expand Down