Import packages/plugin/src/connection-controller.ts

This commit is contained in:
QQ 2026-11-17 08:46:52 +08:00
parent 1b07c25a60
commit 698af5b622
1 changed files with 3 additions and 1 deletions

View File

@ -16,7 +16,9 @@ interface ActiveConnection {
}
export interface PeerConnectionContext {
peerIdentityKey?: string
transportMode?: () => AuthenticatedPeerChannel['mode']
createTransportUpgradeHost?: AuthenticatedPeerChannel['createTransportUpgradeHost']
connectionId: string
peerDeviceId: string
}
@ -89,7 +91,7 @@ export class ConnectionController {
await Promise.all(replaced.map(connection => this.disconnect(connection, 'CONNECTION_REPLACED')))
const router = this.createRouter(
{ connectionId, peerDeviceId: channel.peerDeviceId, transportMode: () => channel.mode },
{ connectionId, peerDeviceId: channel.peerDeviceId, peerIdentityKey: channel.peerIdentityKey, transportMode: () => channel.mode, createTransportUpgradeHost: channel.createTransportUpgradeHost?.bind(channel) },
message => this.sendTo(connectionId, channel, message),
)
const connection: ActiveConnection = {