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

    Function createMultiplayerApi

    • Creates an API for accessing the multiplayer server at the given origin.

      Parameters

      • __namedParameters: {
            backendOrigin?: string;
            portScanOptions:
                | undefined
                | boolean
                | Readonly<Omit<FindPortOptions, "isValidResponse">>;
        }
        • OptionalbackendOrigin?: string
        • portScanOptions: undefined | boolean | Readonly<Omit<FindPortOptions, "isValidResponse">>

          Set to undefined or false to disable port scanning. Set to true to enable port scanning. Set to an options object to configure port scanning.

      Returns Promise<
          RestVirApi<
              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<
                                              `${(...)}-${(...)}-${(...)}-${(...)}-${(...)}`,
                                          >;
                                          required: false;
                                          values: ShapeDefinition<
                                              {
                                                  clientCount: ...;
                                                  hasRoomPassword: ...;
                                                  roomId: ...;
                                                  roomName: ...;
                                              },
                                              false,
                                          >;
                                      },
                                  ],
                              >,
                              false,
                          >;
                          searchParamsShape: { gameId: ShapeTuple<[string]> };
                      };
                  },
                  {
                      "/connect": {
                          messageFromClientShape: ShapeOr<
                              [
                                  ShapeDefinition<
                                      ShapeAnd<
                                          [
                                              ShapeDefinition<(...), (...)>,
                                              ShapeDefinition<(...), (...)>,
                                              { data: ...; type: ... },
                                          ],
                                      >,
                                      false,
                                  >,
                                  ShapeDefinition<
                                      ShapeAnd<
                                          [
                                              ShapeDefinition<(...), (...)>,
                                              ShapeDefinition<(...), (...)>,
                                              { clientSecret: ...; roomPassword: ... },
                                          ],
                                      >,
                                      false,
                                  >,
                                  ShapeDefinition<
                                      ShapeAnd<
                                          [
                                              ShapeDefinition<(...), (...)>,
                                              ShapeDefinition<(...), (...)>,
                                              {
                                                  clientCount: ...;
                                                  clientSecret: ...;
                                                  roomPassword: ...;
                                                  type: ...;
                                              },
                                          ],
                                      >,
                                      false,
                                  >,
                              ],
                          >;
                          messageFromHostShape: ShapeOr<
                              [
                                  ShapeDefinition<
                                      ShapeAnd<
                                          [
                                              ShapeDefinition<(...), (...)>,
                                              ShapeDefinition<(...), (...)>,
                                              { data: ...; type: ... },
                                          ],
                                      >,
                                      false,
                                  >,
                                  ShapeDefinition<
                                      ShapeAnd<
                                          [
                                              ShapeDefinition<(...), (...)>,
                                              ShapeDefinition<(...), (...)>,
                                              { data: ...; type: ... },
                                          ],
                                      >,
                                      false,
                                  >,
                                  ShapeDefinition<
                                      ShapeAnd<
                                          [
                                              ShapeDefinition<(...), (...)>,
                                              { hostClientId: ...; type: ... },
                                          ],
                                      >,
                                      false,
                                  >,
                                  ShapeDefinition<
                                      ShapeAnd<
                                          [
                                              ShapeDefinition<(...), (...)>,
                                              { errorMessage: ...; type: ... },
                                          ],
                                      >,
                                      false,
                                  >,
                              ],
                          >;
                          searchParamsShape: { gameId: ShapeTuple<[string]> };
                      };
                  },
              >,
          >,
      >