File tree Expand file tree Collapse file tree 1 file changed +0
-51
lines changed
Expand file tree Collapse file tree 1 file changed +0
-51
lines changed Original file line number Diff line number Diff line change @@ -326,55 +326,4 @@ export class GunRegistry {
326326 } ) ;
327327 } ) ;
328328 }
329-
330- public async sendSignalingMessage (
331- targetPeer : string ,
332- message : Record < string , unknown >
333- ) : Promise < void > {
334- if ( ! this . isGunAvailable || ! this . gun ) {
335- throw new Error ( "Gun.js registry not available" ) ;
336- }
337-
338- const messageWithTimestamp = {
339- ...message ,
340- timestamp : Date . now ( ) ,
341- } ;
342-
343- this . gun
344- . get ( this . options . namespace ! )
345- . get ( "signaling" )
346- . get ( targetPeer )
347- . put ( messageWithTimestamp ) ;
348- }
349-
350- public onSignalingMessage (
351- storeId : string ,
352- callback : ( message : Record < string , unknown > ) => void
353- ) : void {
354- if ( ! this . isGunAvailable || ! this . gun ) {
355- console . warn ( "Gun.js not available, signaling will not work" ) ;
356- return ;
357- }
358-
359- this . gun
360- . get ( this . options . namespace ! )
361- . get ( "signaling" )
362- . get ( storeId )
363- . on ( ( data : Record < string , unknown > ) => {
364- if ( data && data . timestamp ) {
365- callback ( data ) ;
366- }
367- } ) ;
368- }
369-
370- public async unregister ( storeId : string ) : Promise < void > {
371- if ( ! this . isGunAvailable || ! this . gun ) {
372- throw new Error ( "Gun.js registry not available" ) ;
373- }
374-
375- // Remove from registry
376- this . gun . get ( this . options . namespace ! ) . get ( "hosts" ) . get ( storeId ) . put ( null ) ;
377-
378- console . log ( `Unregistered host ${ storeId } ` ) ;
379- }
380329}
You can’t perform that action at this time.
0 commit comments