public SyncService(SyncRoom room) { // some kind of dependency injection trick (I think..) - but it works room.AddService(this); Nickname = GfycatNameGenerator.GetName(); }
public static SyncRoom CreateRoom(string code = "") { SyncRoom room; if (string.IsNullOrWhiteSpace(code)) { room = new SyncRoom(); } else { room = new SyncRoom(code); } Logger.Log("Room {0} created successfully.", room.RoomCode); rooms.Add(room); httpsv.AddWebSocketService("/" + room.RoomCode, () => new SyncService(room)); return(room); }