gemercheung 3 years ago
parent
commit
0a29a2bbf7
2 changed files with 8 additions and 10 deletions
  1. 7 9
      src/app.controller.ts
  2. 1 1
      src/ws-adapter.ts

+ 7 - 9
src/app.controller.ts

@@ -3,12 +3,7 @@ import { AppService } from './app.service';
 // import { UtilsModule } from '@app/utils';
 // import { UtilsModule } from '@app/utils';
 import { grpcClientOptions } from './grpc-scene.options';
 import { grpcClientOptions } from './grpc-scene.options';
 
 
-import {
-  GrpcMethod,
-  ClientGrpc,
-  Client,
-  Transport,
-} from '@nestjs/microservices';
+import { ClientGrpc, Client } from '@nestjs/microservices';
 import { Observable } from 'rxjs';
 import { Observable } from 'rxjs';
 
 
 interface Point {
 interface Point {
@@ -40,7 +35,7 @@ export class AppController implements OnModuleInit {
       this.client.getService<SceneGrpcService>('SceneGrpcService');
       this.client.getService<SceneGrpcService>('SceneGrpcService');
   }
   }
   @Get()
   @Get()
-  getHello(): Observable<any> {
+  getHello(): string {
     // console.log('UtilsModule', UtilsModule);
     // console.log('UtilsModule', UtilsModule);
     const params: routeParam = {
     const params: routeParam = {
       sLocation: {
       sLocation: {
@@ -56,7 +51,10 @@ export class AppController implements OnModuleInit {
       sceneCode: 'Hello',
       sceneCode: 'Hello',
     };
     };
     console.log('params', params);
     console.log('params', params);
-    return this.sceneGrpcService.getRoute(params);
-    // return this.appService.getHello();
+    const test = this.sceneGrpcService.getRoute(params);
+    test.subscribe((val) => {
+      console.log('val', val);
+    });
+    return this.appService.getHello();
   }
   }
 }
 }

+ 1 - 1
src/ws-adapter.ts

@@ -145,7 +145,7 @@ export class WsAdapter extends AbstractWsAdapter {
     return server;
     return server;
   }
   }
 
 
-  public bindClientDisconnect(client: any, callback: Function) {
+  public bindClientDisconnect(client: any, callback: () => void) {
     client.on(CLOSE_EVENT, callback);
     client.on(CLOSE_EVENT, callback);
   }
   }