File tree 2 files changed +16
-7
lines changed
augmentos_cloud/packages/cloud/src/services/core
2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ export class AppService {
219
219
data : WebhookResponse ;
220
220
} > {
221
221
// Construct the stop webhook URL from the app's public URL
222
- const webhookUrl = `${ publicUrl } /webhook/stop ` ;
222
+ const webhookUrl = `${ publicUrl } /webhook` ;
223
223
const response = await axios . post ( webhookUrl , payload ) ;
224
224
return {
225
225
status : response . status ,
Original file line number Diff line number Diff line change @@ -537,15 +537,13 @@ export class WebSocketService {
537
537
( appName ) => appName !== packageName
538
538
) ;
539
539
540
- // Optional: Trigger stop webhook if needed
541
- // Uncomment this if you want to implement stop webhook calls
542
- /*
540
+
543
541
try {
544
542
const tpaSessionId = `${ userSession . sessionId } -${ packageName } ` ;
545
- await this. appService.triggerStopWebhook(
543
+ await appService . triggerStopWebhook (
546
544
app . publicUrl ,
547
545
{
548
- type: 'stop_request' ,
546
+ type : WebhookRequestType . STOP_REQUEST ,
549
547
sessionId : tpaSessionId ,
550
548
userId : userSession . userId ,
551
549
reason : 'user_disabled' ,
@@ -556,7 +554,18 @@ export class WebSocketService {
556
554
userSession . logger . error ( `Error calling stop webhook for ${ packageName } :` , error ) ;
557
555
// Continue with cleanup even if webhook fails
558
556
}
559
- */
557
+
558
+ // End the websocket connection for the app
559
+ try {
560
+ const websocket = userSession . appConnections . get ( packageName ) ;
561
+ if ( websocket && websocket . readyState === WebSocket . OPEN ) {
562
+ websocket . close ( ) ;
563
+ userSession . appConnections . delete ( packageName ) ;
564
+ }
565
+ } catch ( error ) {
566
+ userSession . logger . error ( `Error ending websocket for TPA ${ packageName } :` , error ) ;
567
+ // Continue with cleanup even if webhook fails
568
+ }
560
569
561
570
// Update user's running apps in database
562
571
try {
You can’t perform that action at this time.
0 commit comments