server.createRoom()
crookse opened this issue · 1 comments
crookse commented
This depends on #11 Room class.
Expose the following syntax to create a new room:
class SocketServer {
const rooms: Room[] = {};
createRoom(name: string, isPrivate: boolean = false): Room {
return new Room(name, isPrivate);
}
}
so that the following can be written:
const server = new SocketServer();
const pub = server.createRoom("My Public Room");
const priv = server.createRoom("My Private Room", true);
pub.rename("My Public Room Renamed");
priv.rename("My Private Room Renamed");
pub.close();
priv.close();