File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -81,11 +81,14 @@ export class BlockService extends BaseService<
81
81
subscribe ( @SocketReq ( ) req : SocketRequest , @SocketRes ( ) res : SocketResponse ) {
82
82
try {
83
83
if ( req . session . web ?. profile ?. id ) {
84
- this . gateway . io . socketsJoin ( `blocks:${ req . session . web . profile . id } ` ) ;
84
+ const room = `blocks:${ req . session . web . profile . id } ` ;
85
+ this . gateway . io . socketsJoin ( room ) ;
86
+ this . logger . log ( 'Subscribed to socket room' , room ) ;
85
87
return res . status ( 200 ) . json ( {
86
88
success : true ,
87
89
} ) ;
88
90
} else {
91
+ this . logger . error ( 'Unable to subscribe to highlight blocks room' ) ;
89
92
throw new Error ( 'Unable to join highlight blocks room' ) ;
90
93
}
91
94
} catch ( e ) {
Original file line number Diff line number Diff line change @@ -413,14 +413,15 @@ export class WebsocketGateway
413
413
async handleHighlightBlock (
414
414
payload : IHookOperationMap [ 'highlight' ] [ 'operations' ] [ 'block' ] ,
415
415
) {
416
+ this . logger . log ( 'highlighting block' , payload ) ;
416
417
this . io . to ( `blocks:${ payload . userId } ` ) . emit ( 'highlight:block' , payload ) ;
417
418
}
418
419
419
420
@OnEvent ( 'hook:highlight:error' )
420
421
async highlightBlockErrored (
421
422
payload : IHookOperationMap [ 'highlight' ] [ 'operations' ] [ 'error' ] ,
422
423
) {
423
- this . logger . warn ( 'hook:highlight:error ' , payload ) ;
424
+ this . logger . warn ( 'hook:highlight:error' , payload ) ;
424
425
this . io . to ( `blocks:${ payload . userId } ` ) . emit ( 'highlight:error' , payload ) ;
425
426
}
426
427
}
Original file line number Diff line number Diff line change @@ -41,10 +41,7 @@ export const SocketProvider = (props: PropsWithChildren) => {
41
41
const [ connected , setConnected ] = useState ( false ) ;
42
42
const { toast } = useToast ( ) ;
43
43
const { user } = useAuth ( ) ;
44
- const socket = useMemo (
45
- ( ) => new SocketIoClient ( apiUrl , { auth : user } ) ,
46
- [ apiUrl ] ,
47
- ) ;
44
+ const socket = useMemo ( ( ) => new SocketIoClient ( apiUrl ) , [ apiUrl ] ) ;
48
45
49
46
useEffect ( ( ) => {
50
47
if ( user && apiUrl )
You can’t perform that action at this time.
0 commit comments