Skip to content

Commit c1b78d8

Browse files
committed
feat: add vhost to ConnectionInfo
1 parent 27c7104 commit c1b78d8

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/connection.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export type ConnectionInfo = {
6262
port: number
6363
id: string
6464
ready: boolean
65+
vhost: string
6566
readable?: boolean
6667
writable?: boolean
6768
localPort?: number
@@ -376,6 +377,7 @@ export class Connection {
376377
writable: this.socket.writable,
377378
localPort: this.socket.localPort,
378379
ready: this.ready,
380+
vhost: this.vhost
379381
}
380382
}
381383

src/consumer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ export class StreamConsumer implements Consumer {
7676
}
7777

7878
public getConnectionInfo(): ConnectionInfo {
79-
const { host, port, id, readable, localPort, ready } = this.connection.getConnectionInfo()
80-
return { host, port, id, readable, localPort, ready }
79+
const { host, port, id, readable, localPort, ready, vhost } = this.connection.getConnectionInfo()
80+
return { host, port, id, readable, localPort, ready, vhost }
8181
}
8282

8383
public get localOffset() {

src/publisher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ export class StreamPublisher implements Publisher {
180180
}
181181

182182
public getConnectionInfo(): ConnectionInfo {
183-
const { host, port, id, writable, localPort, ready } = this.connection.getConnectionInfo()
184-
return { host, port, id, writable, localPort, ready }
183+
const { host, port, id, writable, localPort, ready, vhost } = this.connection.getConnectionInfo()
184+
return { host, port, id, writable, localPort, ready, vhost }
185185
}
186186

187187
public on(event: "metadata_update", listener: MetadataUpdateListener): void

test/e2e/stream_cache.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ describe("cache", () => {
8181
const publisher1 = await client.declarePublisher({
8282
stream: streamName,
8383
})
84-
expect(publisher1.connection.params.vhost).eql("/")
84+
expect(publisher1.getConnectionInfo().vhost).eql("/")
8585
const publisher2 = await client2.declarePublisher({
8686
stream: streamName,
8787
})
88-
expect(publisher2.connection.params.vhost).eql(vhost1)
88+
expect(publisher2.getConnectionInfo().vhost).eql(vhost1)
8989
})
9090
})

0 commit comments

Comments
 (0)