@@ -12,16 +12,16 @@ window.addEventListener('load', () => {
1212 ] ) ;
1313
1414 // Create the client
15- const client = new Client ( 'ws://localhost :8002' , encoder ) ;
15+ const client = new Client ( 'ws://127.0.0.1 :8002' , encoder ) ;
1616 let ping ;
1717
1818 // Listen for a "pong" event
19- client . on ( 'pong' , pong => {
19+ client . on ( 'pong' , ( { detail : pong } ) => {
2020 console . info ( 'pong: %s ms' , pong - ping ) ;
2121 } ) ;
2222
2323 // Listen for an "id" event
24- client . on ( 'id' , id => {
24+ client . on ( 'id' , ( { detail : id } ) => {
2525 console . log ( 'connected with id %s' , id ) ;
2626 ping = Date . now ( ) ;
2727
@@ -30,12 +30,12 @@ window.addEventListener('load', () => {
3030 } ) ;
3131
3232 // Listen for a "total" event
33- client . on ( 'total' , total => {
33+ client . on ( 'total' , ( { detail : total } ) => {
3434 console . log ( `There is ${ total } people connected.` )
3535 } ) ;
3636
3737 // Listen for an "inverse" event
38- client . on ( 'inverse' , status => {
38+ client . on ( 'inverse' , ( { detail : status } ) => {
3939 // Answer with an "inverse" event
4040 client . send ( 'inverse' , ! status ) ;
4141 console . log ( 'Inverse received: %s' , status ) ;
@@ -45,7 +45,7 @@ window.addEventListener('load', () => {
4545 } ) ;
4646
4747 // Listen for a "greeting" event
48- client . on ( 'greeting' , message => {
48+ client . on ( 'greeting' , ( { detail : message } ) => {
4949 console . log ( 'Servers geets you: "%s"' , message ) ;
5050 } ) ;
5151
0 commit comments