Skip to content

修改rpc, 使其兼容fetch和process模式#484

Open
tangkaikk wants to merge 1 commit intococos:mainfrom
tangkaikk:rpcChange
Open

修改rpc, 使其兼容fetch和process模式#484
tangkaikk wants to merge 1 commit intococos:mainfrom
tangkaikk:rpcChange

Conversation

@tangkaikk
Copy link
Copy Markdown
Contributor

No description provided.

@tangkaikk tangkaikk changed the title 修改rpc, 是其兼容fetch和process模式 修改rpc, 使其兼容fetch和process模式 Apr 14, 2026
};
globalEventEmitter.emit(event, ...args);
if ('connected' in process) {
process.send?.(message);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

这个修改破坏 mcp模式的兼容性

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

是的, 还需要做下兼容。昨天只是先把做的web先提交了。今天还需要处理。

globalThis.self = window;
this._executor.addPolyfillFile(require.resolve('@cocos/build-polyfills/prebuilt/editor/bundle'));
// Web 改造:
// - 移除 globalThis.self = window(Web 环境中 self 已自动指向 window 或 WorkerGlobalScope)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

移除self = window.
mcp 模式下能正常工作?

const timer = setTimeout(() => controller.abort(), timeout);

try {
const response = await fetch(`${this.baseURL}/scene/rpc`, {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

所有rpc请求统一转换到 scene/rpc ? 路由不用修改?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants