@@ -34,6 +34,7 @@ import { WebSocket } from "@spacebar/gateway";
34
34
import "missing-native-js-functions" ;
35
35
import { Channel as AMQChannel } from "amqplib" ;
36
36
import { Recipient } from "@spacebar/util" ;
37
+ import * as console from "node:console" ;
37
38
38
39
// TODO: close connection on Invalidated Token
39
40
// TODO: check intent
@@ -88,9 +89,12 @@ export async function setupListener(this: WebSocket) {
88
89
this . listen_options = opts ;
89
90
const consumer = consume . bind ( this ) ;
90
91
92
+ console . log ( "[RabbitMQ] setupListener: open for " , this . user_id ) ;
91
93
if ( RabbitMQ . connection ) {
94
+ console . log ( "[RabbitMQ] setupListener: opts.channel = " , typeof opts . channel , opts . channel ) ;
92
95
opts . channel = await RabbitMQ . connection . createChannel ( ) ;
93
96
opts . channel . queues = { } ;
97
+ console . log ( "[RabbitMQ] channel created: " , typeof opts . channel , opts . channel ) ;
94
98
}
95
99
96
100
this . events [ this . user_id ] = await listenEvent ( this . user_id , consumer , opts ) ;
@@ -128,6 +132,7 @@ export async function setupListener(this: WebSocket) {
128
132
} ) ;
129
133
130
134
this . once ( "close" , ( ) => {
135
+ console . log ( "[RabbitMQ] setupListener: close for " , this . user_id , "=" , typeof opts . channel , opts . channel ) ;
131
136
if ( opts . channel ) opts . channel . close ( ) ;
132
137
else {
133
138
Object . values ( this . events ) . forEach ( ( x ) => x ?.( ) ) ;
0 commit comments