Skip to content

Can't use Lobby to pair #1

@vishalkrishnads

Description

@vishalkrishnads

Since Lobby can't contain a db field, it is impossible to pair a vehicle to it's user through it. The application requirements state that a user & vehicle should be able to use a single websocket connection to execute the pair. This is necessary to implement QR code pairing at the client side.

  • The default() method doesn't support args

    impl Default for Lobby {
        // default() can't take args
        fn default(db: Database) -> Lobby {
            Lobby {
                db_instance: db,
                sessions: Hashmap::new(),
                rooms: Hashmap::new()
            }
        }
    }
  • There is no way to make the default() method async in Lobby, or anywhere basically.

    impl Default for Lobby {
        // this throws an error
        async fn default() -> Lobby {
            // async code to spin up a new connection to db
            Lobby {
              db_instnace: <db_object>,
              sessions: Hashmap::new(),
              rooms: Hashmap::new()
            }
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions