feat(core): enable socket cors (#12823)

fix android & ios selfhost syncing

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved WebSocket connection compatibility by enabling cross-origin
requests with credentials and restricting allowed HTTP methods to GET
and POST.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: fengmk2 <fengmk2@gmail.com>
This commit is contained in:
EYHN
2025-06-17 09:40:08 +08:00
committed by GitHub
co-authored by fengmk2
parent 2366c1aba6
commit c1691157f9
@@ -20,6 +20,12 @@ export class SocketIoAdapter extends IoAdapter {
const server: Server = super.createIOServer(port, { const server: Server = super.createIOServer(port, {
...config, ...config,
...options, ...options,
// Enable CORS for Socket.IO
cors: {
origin: true, // Allow all origins
credentials: true, // Allow credentials (cookies, auth headers)
methods: ['GET', 'POST'],
},
}); });
if (config.canActivate) { if (config.canActivate) {