 				}
 			}
 			
+			//TODO: Add close reason?
 			//Connection closed
 			webSocket.onClose = { ws in
 				guard let u = user else {

						switch (reqType) {
						case "initialAuth":
							user = try initialAuth(message: message, socket: webSocket)
						case "getCanvas":
							try sendCanvas(json: json, user: user!)
						case "postTile":

			user.sendJSON(json: json)
		}
		
		func userIDValid(id: String) -> Bool {
			//TODO
			return true
		}
		
		//User requests
		func handleTilePlace(json: JSON) throws {
			//First get params
			guard let userID = json.object?["userID"]?.string else {
				throw BackendError.noUserID
			}
			guard let Xcoord = json.object?["X"]?.int else {
				throw BackendError.parameterMissingX
			}
			guard let Ycoord = json.object?["Y"]?.int else {
				throw BackendError.parameterMissingY
			}
			guard let colorID = json.object?["colorID"]?.int else {
				throw BackendError.parameterMissingColorID
			}
			
			//Verifications here (uuid valid? tiles available? etc)
			//Check that coordinates are valid
			guard Xcoord <= canvas.width,
				  Ycoord <= canvas.height else {
					throw BackendError.invalidCoordinates
			}
			
			//Verify userID is valid
			guard userIDValid(id: userID) else {
				throw BackendError.invalidUserID
			}
			
			//Then store this action to DB
			
			//Then update canvas
