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