@game-vir/multiplayer - v15.1.1
    Preparing search index...

    Function defineMultiplayerService

    • The multiplayer service definition.

      Parameters

      • backendOrigin: string = defaultMultiplayerServiceOrigin

      Returns ServiceDefinition<
          "multiplayer-service",
          {
              "/": {
                  methods: { GET: true };
                  requestDataShape: undefined;
                  requiredClientOrigin: {};
                  responseDataShape: ShapeExact<readonly ["ok"]>;
              };
              "/health": {
                  methods: { GET: true };
                  requestDataShape: undefined;
                  requiredClientOrigin: {};
                  responseDataShape: ShapeExact<readonly ["ok"]>;
              };
              "/rooms": {
                  methods: { GET: true };
                  requestDataShape: undefined;
                  responseDataShape: ShapeDefinition<
                      ShapeIndexedKeys<
                          [
                              {
                                  keys: CustomSpecifier<
                                      `${string}-${string}-${string}-${string}-${string}`,
                                  >;
                                  required: false;
                                  values: ShapeDefinition<
                                      {
                                          clientCount: number;
                                          hasRoomPassword: boolean;
                                          roomId: CustomSpecifier<
                                              `${(...)}-${(...)}-${(...)}-${(...)}-${(...)}`,
                                          >;
                                          roomName: string;
                                      },
                                      false,
                                  >;
                              },
                          ],
                      >,
                      false,
                  >;
                  searchParamsShape: { gameId: ShapeTuple<[string]> };
              };
          },
          {
              "/connect": {
                  messageFromClientShape: ShapeOr<
                      [
                          ShapeDefinition<
                              ShapeAnd<
                                  [
                                      ShapeDefinition<
                                          {
                                              clientId: CustomSpecifier<(...)>;
                                              roomId: CustomSpecifier<(...)>;
                                              roomName: string;
                                          },
                                          false,
                                      >,
                                      ShapeDefinition<{ messageId: CustomSpecifier<(...)> }, false>,
                                      {
                                          data: ShapeOr<[(...), (...)]>;
                                          type: ShapeExact<readonly [(...)]>;
                                      },
                                  ],
                              >,
                              false,
                          >,
                          ShapeDefinition<
                              ShapeAnd<
                                  [
                                      ShapeDefinition<ShapeAnd<[(...), (...), (...)]>, false>,
                                      ShapeDefinition<{ messageId: CustomSpecifier<(...)> }, false>,
                                      { clientSecret: string; roomPassword: string },
                                  ],
                              >,
                              false,
                          >,
                          ShapeDefinition<
                              ShapeAnd<
                                  [
                                      ShapeDefinition<
                                          {
                                              clientId: CustomSpecifier<(...)>;
                                              roomId: CustomSpecifier<(...)>;
                                              roomName: string;
                                          },
                                          false,
                                      >,
                                      ShapeDefinition<{ messageId: CustomSpecifier<(...)> }, false>,
                                      {
                                          clientCount: number;
                                          clientSecret: string;
                                          roomPassword: string;
                                          type: ShapeExact<readonly [(...)]>;
                                      },
                                  ],
                              >,
                              false,
                          >,
                      ],
                  >;
                  messageFromHostShape: ShapeOr<
                      [
                          ShapeDefinition<
                              ShapeAnd<
                                  [
                                      ShapeDefinition<
                                          {
                                              clientId: CustomSpecifier<(...)>;
                                              roomId: CustomSpecifier<(...)>;
                                              roomName: string;
                                          },
                                          false,
                                      >,
                                      ShapeDefinition<{ messageId: CustomSpecifier<(...)> }, false>,
                                      {
                                          data: ShapeOr<[(...), (...)]>;
                                          type: ShapeExact<readonly [(...)]>;
                                      },
                                  ],
                              >,
                              false,
                          >,
                          ShapeDefinition<
                              ShapeAnd<
                                  [
                                      ShapeDefinition<
                                          {
                                              clientId: CustomSpecifier<(...)>;
                                              roomId: CustomSpecifier<(...)>;
                                              roomName: string;
                                          },
                                          false,
                                      >,
                                      ShapeDefinition<{ messageId: CustomSpecifier<(...)> }, false>,
                                      {
                                          data: ShapeDefinition<{ sdp: ...; type: ... }, false>;
                                          type: ShapeExact<readonly [(...)]>;
                                      },
                                  ],
                              >,
                              false,
                          >,
                          ShapeDefinition<
                              ShapeAnd<
                                  [
                                      ShapeDefinition<{ messageId: CustomSpecifier<(...)> }, false>,
                                      {
                                          hostClientId: CustomSpecifier<
                                              `${(...)}-${(...)}-${(...)}-${(...)}-${(...)}`,
                                          >;
                                          type: ShapeExact<readonly [(...)]>;
                                      },
                                  ],
                              >,
                              false,
                          >,
                          ShapeDefinition<
                              ShapeAnd<
                                  [
                                      ShapeDefinition<{ messageId: CustomSpecifier<(...)> }, false>,
                                      { errorMessage: string; type: ShapeExact<readonly [(...)]> },
                                  ],
                              >,
                              false,
                          >,
                      ],
                  >;
                  searchParamsShape: { gameId: ShapeTuple<[string]> };
              };
          },
      >