gemercheung 3 år sedan
förälder
incheckning
14283f1d97
5 ändrade filer med 145 tillägg och 45 borttagningar
  1. 1 0
      package.json
  2. 12 9
      src/app.controller.ts
  3. 3 0
      src/scene/grpc-scene.options.ts
  4. 121 36
      src/scene/scene.service.ts
  5. 8 0
      yarn.lock

+ 1 - 0
package.json

@@ -32,6 +32,7 @@
     "@nestjs/platform-ws": "^8.4.4",
     "@nestjs/websockets": "^8.4.4",
     "buffer": "^6.0.3",
+    "multistream": "^4.1.0",
     "nestjs-redis": "^1.3.3",
     "node-datachannel": "^0.3.2",
     "redis": "^4",

+ 12 - 9
src/app.controller.ts

@@ -4,7 +4,7 @@ import { AppService } from './app.service';
 import { grpcClientOptions } from './scene/grpc-scene.options';
 
 import { ClientGrpc, Client } from '@nestjs/microservices';
-
+import { SceneService } from './scene/scene.service';
 interface Point {
   x: string;
   y: string;
@@ -15,7 +15,10 @@ export class AppController implements OnModuleInit {
   @Client(grpcClientOptions) private readonly client: ClientGrpc;
   private sceneGrpcService: SceneGrpcService;
 
-  constructor(private readonly appService: AppService) { }
+  constructor(
+    private readonly appService: AppService,
+    private readonly sceneService: SceneService,
+  ) {}
 
   onModuleInit() {
     // console.log('this.client', this.client);
@@ -70,7 +73,6 @@ export class AppController implements OnModuleInit {
       // initReply.subscribe((val) => {
       //   console.log('val', val);
       // });
-
       // const params = {
       //   action_type: 1009,
       //   echo_msg: {
@@ -79,13 +81,14 @@ export class AppController implements OnModuleInit {
       //   trace_id: '2b6e3444-63eb-40a7-8049-1d6616f16664',
       //   user_id: '31a6322c-78f1-4744-99df-bc042f50bebc',
       // };
-      const initReply = this.sceneGrpcService.test({
-        name: 'lala',
-      });
-      initReply.subscribe((val) => {
-        console.log('val', val);
-      });
+      // const initReply = this.sceneGrpcService.test({
+      //   name: 'lala',
+      // });
+      // initReply.subscribe((val) => {
+      //   console.log('val', val);
+      // });
       // console.log('initReply')
+      this.sceneService.pushTheFirstFrame();
     } catch (error) {
       console.log('test', error);
     }

+ 3 - 0
src/scene/grpc-scene.options.ts

@@ -7,5 +7,8 @@ export const grpcClientOptions: ClientOptions = {
     url: process.env.GRPC_URL,
     package: 'scene',
     protoPath: join(__dirname, '..', 'proto/scene.proto'),
+    // loader: {
+    //   keepCase: false,
+    // }
   },
 };

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 121 - 36
src/scene/scene.service.ts


+ 8 - 0
yarn.lock

@@ -4072,6 +4072,14 @@ multer@1.4.4:
     type-is "^1.6.4"
     xtend "^4.0.0"
 
+multistream@^4.1.0:
+  version "4.1.0"
+  resolved "https://registry.npmmirror.com/multistream/-/multistream-4.1.0.tgz#7bf00dfd119556fbc153cff3de4c6d477909f5a8"
+  integrity sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw==
+  dependencies:
+    once "^1.4.0"
+    readable-stream "^3.6.0"
+
 mute-stream@0.0.8:
   version "0.0.8"
   resolved "https://registry.npmmirror.com/mute-stream/-/mute-stream-0.0.8.tgz"